From: xtkoba+ruby@... Date: 2021-04-15T01:34:23+00:00 Subject: [ruby-core:103456] [Ruby master Bug#17804] Math.cbrt(0.0) returns NaN Issue #17804 has been updated by xtkoba (Tee KOBAYASHI). FWIW, that code was introduced by commit commit:c995315153f7403636ec0d6119b7885668b32039. ---------------------------------------- Bug #17804: Math.cbrt(0.0) returns NaN https://bugs.ruby-lang.org/issues/17804#change-91551 * Author: chasonr (Ray Chason) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- 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. -- https://bugs.ruby-lang.org/ Unsubscribe: