aboutsummaryrefslogtreecommitdiff
path: root/std/math/complex/ldexp.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-17 00:56:14 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-17 00:56:14 -0400
commitb73307befb49dd3b131d99ecf1c7f3fb54578ec8 (patch)
tree259f4eccb92739e8f420a704ff3b49e7b0c1762f /std/math/complex/ldexp.zig
parent288fc3a8d361972daeded19d207b410128d70d67 (diff)
downloadzig-b73307befb49dd3b131d99ecf1c7f3fb54578ec8.tar.gz
zig-b73307befb49dd3b131d99ecf1c7f3fb54578ec8.zip
more std lib to postfix deref with zig fmt
Diffstat (limited to 'std/math/complex/ldexp.zig')
-rw-r--r--std/math/complex/ldexp.zig17
1 files changed, 7 insertions, 10 deletions
diff --git a/std/math/complex/ldexp.zig b/std/math/complex/ldexp.zig
index 4fb5a6815f..7ebefff40c 100644
--- a/std/math/complex/ldexp.zig
+++ b/std/math/complex/ldexp.zig
@@ -15,12 +15,12 @@ pub fn ldexp_cexp(z: var, expt: i32) Complex(@typeOf(z.re)) {
}
fn frexp_exp32(x: f32, expt: &i32) f32 {
- const k = 235; // reduction constant
- const kln2 = 162.88958740; // k * ln2
+ const k = 235; // reduction constant
+ const kln2 = 162.88958740; // k * ln2
const exp_x = math.exp(x - kln2);
const hx = @bitCast(u32, exp_x);
- *expt = i32(hx >> 23) - (0x7f + 127) + k;
+ expt.* = i32(hx >> 23) - (0x7f + 127) + k;
return @bitCast(f32, (hx & 0x7fffff) | ((0x7f + 127) << 23));
}
@@ -35,15 +35,12 @@ fn ldexp_cexp32(z: &const Complex(f32), expt: i32) Complex(f32) {
const half_expt2 = exptf - half_expt1;
const scale2 = @bitCast(f32, (0x7f + half_expt2) << 23);
- return Complex(f32).new(
- math.cos(z.im) * exp_x * scale1 * scale2,
- math.sin(z.im) * exp_x * scale1 * scale2,
- );
+ return Complex(f32).new(math.cos(z.im) * exp_x * scale1 * scale2, math.sin(z.im) * exp_x * scale1 * scale2);
}
fn frexp_exp64(x: f64, expt: &i32) f64 {
- const k = 1799; // reduction constant
- const kln2 = 1246.97177782734161156; // k * ln2
+ const k = 1799; // reduction constant
+ const kln2 = 1246.97177782734161156; // k * ln2
const exp_x = math.exp(x - kln2);
@@ -51,7 +48,7 @@ fn frexp_exp64(x: f64, expt: &i32) f64 {
const hx = u32(fx >> 32);
const lx = @truncate(u32, fx);
- *expt = i32(hx >> 20) - (0x3ff + 1023) + k;
+ expt.* = i32(hx >> 20) - (0x3ff + 1023) + k;
const high_word = (hx & 0xfffff) | ((0x3ff + 1023) << 20);
return @bitCast(f64, (u64(high_word) << 32) | lx);