Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glm::min / max difference behavior than std::min / max #372

Closed
KammutierSpule opened this issue Jul 29, 2015 · 4 comments
Closed

glm::min / max difference behavior than std::min / max #372

KammutierSpule opened this issue Jul 29, 2015 · 4 comments
Assignees
Milestone

Comments

@KammutierSpule
Copy link

Hello!
I am using float NAN to initialize my float vectors. In accord to the float.h from gnu builder, I found that it is expected that fmin fmax in the presence of a non number will choose the number.
i.e:
fmin( nan, value) == value
fmax( nan, value) == value

But it looks like the glm::min / max is not behaving the same. is it supposed?

Btw, is that too bad that I use a NAN to set the vector "not initialized" ?

@Groovounet
Copy link
Member

fmin and fmax are C++11 only features which makes it hard to generalize to GLM.

I guess adding an extension exposing vector flavors or fmin and fmax could be nice.

If you carefully using your NaN vectors, that is to say, you are never doing any arithmetic on them, I guess it's not too bad. However, I would not consider it as a great coding practice.

Thanks,
Christophe

@KammutierSpule
Copy link
Author

I was checking, there is a c99 fminf and fmaxf but I didn't test if the behaviour is the same.
it should be:
http://man7.org/linux/man-pages/man3/fmin.3.html

@johnmcfarlane
Copy link

I'd expect for glm::min to behave the same as std::min and for glm::fmin to behave the same as std::fmin etc..

The only minor exception would be that for std::max(a, b) where a == b, then a is returned whereas b should be returned. (This has subtle implications if T is a reference.)

@Groovounet
Copy link
Member

Groovounet commented Aug 20, 2017

This issue is fixed in master branch for GLM 0.9.9 release. Better now than never XD.

Thanks for reporting,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants