aboutsummaryrefslogtreecommitdiff
path: root/std/math/pow.zig
diff options
context:
space:
mode:
authorAndrea Orru <andrea@orru.io>2018-08-06 01:43:19 -0400
committerAndrea Orru <andrea@orru.io>2018-08-06 01:43:19 -0400
commitd2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d (patch)
treee9fa3caec533a0d1e2b434868b2fde1f9240e5c8 /std/math/pow.zig
parent06614b3fa09954464c2e2f32756cacedc178a282 (diff)
parent63a23e848a62d5f167f8d5478de9766cb24aa6eb (diff)
downloadzig-d2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d.tar.gz
zig-d2f5e57b68da0b16e5789ca19045ccbcb4ecfa8d.zip
Merge branch 'master' into zen_stdlib
Diffstat (limited to 'std/math/pow.zig')
-rw-r--r--std/math/pow.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/std/math/pow.zig b/std/math/pow.zig
index 51908f30ea..7fc334c06b 100644
--- a/std/math/pow.zig
+++ b/std/math/pow.zig
@@ -28,7 +28,6 @@ const assert = std.debug.assert;
// This implementation is taken from the go stlib, musl is a bit more complex.
pub fn pow(comptime T: type, x: T, y: T) T {
-
@setFloatMode(this, @import("builtin").FloatMode.Strict);
if (T != f32 and T != f64) {
@@ -147,7 +146,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
var xe = r2.exponent;
var x1 = r2.significand;
- var i = i32(yi);
+ var i = @floatToInt(i32, yi);
while (i != 0) : (i >>= 1) {
if (i & 1 == 1) {
a1 *= x1;
@@ -172,7 +171,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
fn isOddInteger(x: f64) bool {
const r = math.modf(x);
- return r.fpart == 0.0 and i64(r.ipart) & 1 == 1;
+ return r.fpart == 0.0 and @floatToInt(i64, r.ipart) & 1 == 1;
}
test "math.pow" {