tidbits: use C++ cmath functions#1
Conversation
|
@kadet1090 Want to review and merge this one? |
|
I'm fine with the changes but not sure if we want to merge it before upstream had a change to look at it. |
| { | ||
| #ifdef HAVE_ISINF | ||
| return isinf(value); | ||
| if (std::isinf(value)) { return std::signbit(value) ? -1 : 1; } |
There was a problem hiding this comment.
This change actually fixes behavior here to match the documented function return value, which the previous version did not.
But upon an audit, this is not even used, at least on Linux, so there's not much risk of this correctness fix causing an issue.
We need it to fix the snap build in FreeCAD, so I think we should merge it for now, especially since it's quite a basic fix. If upstream wants changes to be done, we can just re-bump the submodule with those fixes. But opened PR against upstream: coin3d#638 |
|
Fine with me, won't be too much problem anyway. |
Summary
std::isinfandstd::isnanfrom<cmath>intidbits.cpp.coin_isinf()'s documented-1/+1return contract withstd::signbit.Motivation
FreeCAD snap builds exposed a portability issue with GCC 13/C++20: Coin detects
isinfandisnanthrough the Cmath.hheader, buttidbits.cppis C++ code including<cmath>, where the portable names are in thestd::namespace. Some environments do not expose the unqualified C names from<cmath>.