diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-19 01:32:15 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-19 01:43:43 -0400 |
| commit | 987768778a67538299f84a6ab7ff0ca65f69d2ac (patch) | |
| tree | 2e7551d76bf9a3e6d242a961eacf7c81aab6025f /std/math/expm1.zig | |
| parent | 558ece8f6f1889bc4773432c16cdf96a54ec1431 (diff) | |
| download | zig-987768778a67538299f84a6ab7ff0ca65f69d2ac.tar.gz zig-987768778a67538299f84a6ab7ff0ca65f69d2ac.zip | |
bit shifting safety
* add u3, u4, u5, u6, u7 and i3, i4, i5, i6, i7
* shift operations shift amount parameter type is
integer with log2 bit width of other param
- This enforces not violating undefined behavior on
shift amount >= bit width with the type system
* clean up math.log, math.ln, math.log2, math.log10
closes #403
Diffstat (limited to 'std/math/expm1.zig')
| -rw-r--r-- | std/math/expm1.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/std/math/expm1.zig b/std/math/expm1.zig index 4343a92117..105d64417a 100644 --- a/std/math/expm1.zig +++ b/std/math/expm1.zig @@ -159,7 +159,7 @@ fn expm1_64(x_: f64) -> f64 { var x = x_; const ux = @bitCast(u64, x); const hx = u32(ux >> 32) & 0x7FFFFFFF; - const sign = hx >> 63; + const sign = ux >> 63; if (math.isNegativeInf(x)) { return -1.0; |
