Md Kaif 7fd7e2db15
fix(float): abs(-0.0) should return 0.0 (#534)
abs(-0.0) returns -0.0 instead of 0.0, and math.fabs(-0.0) does the
same. Both come from the idiom (x < 0) ? -x : x. Since -0.0 < 0 is
false, the negative zero is returned unchanged.

The idiom appears twice, once in dmath_fabs and once open-coded in
float__abs__. Fix dmath_fabs by clearing the sign bit, the same way
dmath_copysign just above it works, and make float__abs__ call the
shared helper instead of repeating the comparison.

abs(-0.0) == 0.0 is true even with the bug, because -0.0 == 0.0 under
IEEE 754, so the added tests compare str(...) to check the sign.
2026-07-21 19:36:08 +08:00
..
2025-09-08 15:41:44 +08:00
2025-09-08 15:41:44 +08:00
2025-09-08 15:41:44 +08:00
2026-07-09 12:46:04 +08:00
2025-09-08 15:41:44 +08:00
2025-09-08 15:41:44 +08:00