| ... | ... | @@ -87,9 +87,9 @@ fn cbrt64(x: f64) f64 { |
| 87 | 87 | u = @as(u64, @bitCast(x * 0x1.0p54)); |
| 88 | 88 | hx = @as(u32, @intCast(u >> 32)) & 0x7FFFFFFF; |
| 89 | 89 | |
| 90 | | // cbrt(0) is itself |
| 90 | // cbrt(+-0) = itself |
| 91 | 91 | if (hx == 0) { |
| 92 | | return 0; |
| 92 | return x; |
| 93 | 93 | } |
| 94 | 94 | hx = hx / 3 + B2; |
| 95 | 95 | } else { |
| ... | ... | @@ -148,7 +148,7 @@ test "math.cbrt64" { |
| 148 | 148 | |
| 149 | 149 | test "math.cbrt.special" { |
| 150 | 150 | try expect(cbrt32(0.0) == 0.0); |
| 151 | | try expect(cbrt32(-0.0) == -0.0); |
| 151 | try expect(@as(u32, @bitCast(cbrt32(-0.0))) == @as(u32, 0x80000000)); |
| 152 | 152 | try expect(math.isPositiveInf(cbrt32(math.inf(f32)))); |
| 153 | 153 | try expect(math.isNegativeInf(cbrt32(-math.inf(f32)))); |
| 154 | 154 | try expect(math.isNan(cbrt32(math.nan(f32)))); |
| ... | ... | @@ -156,7 +156,7 @@ test "math.cbrt.special" { |
| 156 | 156 | |
| 157 | 157 | test "math.cbrt64.special" { |
| 158 | 158 | try expect(cbrt64(0.0) == 0.0); |
| 159 | | try expect(cbrt64(-0.0) == -0.0); |
| 159 | try expect(@as(u64, @bitCast(cbrt64(-0.0))) == @as(u64, 0x8000000000000000)); |
| 160 | 160 | try expect(math.isPositiveInf(cbrt64(math.inf(f64)))); |
| 161 | 161 | try expect(math.isNegativeInf(cbrt64(-math.inf(f64)))); |
| 162 | 162 | try expect(math.isNan(cbrt64(math.nan(f64)))); |