Skip to content

Commit

Permalink
Fixed infinite loop in isfinite function with GCC #221
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Riccio committed Aug 3, 2014
1 parent d84fa89 commit 96ef6ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion glm/gtx/compatibility.inl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// File : glm/gtx/compatibility.inl
///////////////////////////////////////////////////////////////////////////////////////////////////

#include <limits>

namespace glm
{
// isfinite
Expand All @@ -21,7 +23,7 @@ namespace glm
# elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID)
return _isfinite(x) != 0;
# else
return isfinite(x) != 0;
return x >= std::numeric_limits<genType>::min() && x <= std::numeric_limits<genType>::max();
# endif
}

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ GLM 0.9.5.5: 2014-XX-XX
- Fixed std::nextafter not supported with C++11 on Android #213
- Fixed missing value_type for dual quaternion
- Fixed return type of dual quaternion length
- Fixed infinite loop in isfinite function with GCC #221

================================================================================
GLM 0.9.5.4: 2014-06-21
Expand Down

1 comment on commit 96ef6ae

@d-leinhaeuser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If genTypeis a floating point type, std::numeric_limits<genType>::min() is actually the smallest representable positive value (i.e. >0) not the smallest representable value overall.

See std::numeric_limits::min.

Please sign in to comment.