Actions
Bug #17804
closedMath.cbrt(0.0) returns NaN
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
Description
Math.cbrt(0.0) returns NaN. It should return 0.0.
From reading the implementation, I expect this bug to happen only if glibc is in use. The failing section reads:
#if defined GLIBC
if (isfinite(r)) {
r = (2.0 * r + (f / r / r)) / 3.0;
}
#endif
and this produces a NaN when f and r are both 0.
Actions
Like0
Like0Like0Like0