aboutsummaryrefslogtreecommitdiff
path: root/std/math
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-01 11:49:25 -0400
committerGitHub <noreply@github.com>2018-06-01 11:49:25 -0400
commit3918e7699db07540d59aeef7728e5dff54d9e874 (patch)
tree5ccfd67157be19b745c469e923ed92691670b6e9 /std/math
parent717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a (diff)
parente29d12d8218c6f84d4fd59b7c8672d3b38c79390 (diff)
downloadzig-3918e7699db07540d59aeef7728e5dff54d9e874.tar.gz
zig-3918e7699db07540d59aeef7728e5dff54d9e874.zip
Merge pull request #1032 from ziglang/pointer-reform
use * for pointer type instead of &
Diffstat (limited to 'std/math')
-rw-r--r--std/math/complex/atan.zig4
-rw-r--r--std/math/complex/cosh.zig4
-rw-r--r--std/math/complex/exp.zig4
-rw-r--r--std/math/complex/index.zig14
-rw-r--r--std/math/complex/ldexp.zig8
-rw-r--r--std/math/complex/pow.zig2
-rw-r--r--std/math/complex/sinh.zig4
-rw-r--r--std/math/complex/sqrt.zig4
-rw-r--r--std/math/complex/tanh.zig4
-rw-r--r--std/math/hypot.zig2
-rw-r--r--std/math/index.zig4
11 files changed, 27 insertions, 27 deletions
diff --git a/std/math/complex/atan.zig b/std/math/complex/atan.zig
index b7bbf930eb..9bfe5fe724 100644
--- a/std/math/complex/atan.zig
+++ b/std/math/complex/atan.zig
@@ -29,7 +29,7 @@ fn redupif32(x: f32) f32 {
return ((x - u * DP1) - u * DP2) - t * DP3;
}
-fn atan32(z: &const Complex(f32)) Complex(f32) {
+fn atan32(z: *const Complex(f32)) Complex(f32) {
const maxnum = 1.0e38;
const x = z.re;
@@ -78,7 +78,7 @@ fn redupif64(x: f64) f64 {
return ((x - u * DP1) - u * DP2) - t * DP3;
}
-fn atan64(z: &const Complex(f64)) Complex(f64) {
+fn atan64(z: *const Complex(f64)) Complex(f64) {
const maxnum = 1.0e308;
const x = z.re;
diff --git a/std/math/complex/cosh.zig b/std/math/complex/cosh.zig
index 96eac68556..c2f9a47b8d 100644
--- a/std/math/complex/cosh.zig
+++ b/std/math/complex/cosh.zig
@@ -15,7 +15,7 @@ pub fn cosh(z: var) Complex(@typeOf(z.re)) {
};
}
-fn cosh32(z: &const Complex(f32)) Complex(f32) {
+fn cosh32(z: *const Complex(f32)) Complex(f32) {
const x = z.re;
const y = z.im;
@@ -78,7 +78,7 @@ fn cosh32(z: &const Complex(f32)) Complex(f32) {
return Complex(f32).new((x * x) * (y - y), (x + x) * (y - y));
}
-fn cosh64(z: &const Complex(f64)) Complex(f64) {
+fn cosh64(z: *const Complex(f64)) Complex(f64) {
const x = z.re;
const y = z.im;
diff --git a/std/math/complex/exp.zig b/std/math/complex/exp.zig
index 8fe069a43d..44c354f246 100644
--- a/std/math/complex/exp.zig
+++ b/std/math/complex/exp.zig
@@ -16,7 +16,7 @@ pub fn exp(z: var) Complex(@typeOf(z.re)) {
};
}
-fn exp32(z: &const Complex(f32)) Complex(f32) {
+fn exp32(z: *const Complex(f32)) Complex(f32) {
@setFloatMode(this, @import("builtin").FloatMode.Strict);
const exp_overflow = 0x42b17218; // max_exp * ln2 ~= 88.72283955
@@ -63,7 +63,7 @@ fn exp32(z: &const Complex(f32)) Complex(f32) {
}
}
-fn exp64(z: &const Complex(f64)) Complex(f64) {
+fn exp64(z: *const Complex(f64)) Complex(f64) {
const exp_overflow = 0x40862e42; // high bits of max_exp * ln2 ~= 710
const cexp_overflow = 0x4096b8e4; // (max_exp - min_denorm_exp) * ln2
diff --git a/std/math/complex/index.zig b/std/math/complex/index.zig
index 5902ffaa19..b00296beda 100644
--- a/std/math/complex/index.zig
+++ b/std/math/complex/index.zig
@@ -37,28 +37,28 @@ pub fn Complex(comptime T: type) type {
};
}
- pub fn add(self: &const Self, other: &const Self) Self {
+ pub fn add(self: *const Self, other: *const Self) Self {
return Self{
.re = self.re + other.re,
.im = self.im + other.im,
};
}
- pub fn sub(self: &const Self, other: &const Self) Self {
+ pub fn sub(self: *const Self, other: *const Self) Self {
return Self{
.re = self.re - other.re,
.im = self.im - other.im,
};
}
- pub fn mul(self: &const Self, other: &const Self) Self {
+ pub fn mul(self: *const Self, other: *const Self) Self {
return Self{
.re = self.re * other.re - self.im * other.im,
.im = self.im * other.re + self.re * other.im,
};
}
- pub fn div(self: &const Self, other: &const Self) Self {
+ pub fn div(self: *const Self, other: *const Self) Self {
const re_num = self.re * other.re + self.im * other.im;
const im_num = self.im * other.re - self.re * other.im;
const den = other.re * other.re + other.im * other.im;
@@ -69,14 +69,14 @@ pub fn Complex(comptime T: type) type {
};
}
- pub fn conjugate(self: &const Self) Self {
+ pub fn conjugate(self: *const Self) Self {
return Self{
.re = self.re,
.im = -self.im,
};
}
- pub fn reciprocal(self: &const Self) Self {
+ pub fn reciprocal(self: *const Self) Self {
const m = self.re * self.re + self.im * self.im;
return Self{
.re = self.re / m,
@@ -84,7 +84,7 @@ pub fn Complex(comptime T: type) type {
};
}
- pub fn magnitude(self: &const Self) T {
+ pub fn magnitude(self: *const Self) T {
return math.sqrt(self.re * self.re + self.im * self.im);
}
};
diff --git a/std/math/complex/ldexp.zig b/std/math/complex/ldexp.zig
index 7ebefff40c..a56c2ef2eb 100644
--- a/std/math/complex/ldexp.zig
+++ b/std/math/complex/ldexp.zig
@@ -14,7 +14,7 @@ pub fn ldexp_cexp(z: var, expt: i32) Complex(@typeOf(z.re)) {
};
}
-fn frexp_exp32(x: f32, expt: &i32) f32 {
+fn frexp_exp32(x: f32, expt: *i32) f32 {
const k = 235; // reduction constant
const kln2 = 162.88958740; // k * ln2
@@ -24,7 +24,7 @@ fn frexp_exp32(x: f32, expt: &i32) f32 {
return @bitCast(f32, (hx & 0x7fffff) | ((0x7f + 127) << 23));
}
-fn ldexp_cexp32(z: &const Complex(f32), expt: i32) Complex(f32) {
+fn ldexp_cexp32(z: *const Complex(f32), expt: i32) Complex(f32) {
var ex_expt: i32 = undefined;
const exp_x = frexp_exp32(z.re, &ex_expt);
const exptf = expt + ex_expt;
@@ -38,7 +38,7 @@ fn ldexp_cexp32(z: &const Complex(f32), expt: i32) Complex(f32) {
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 {
+fn frexp_exp64(x: f64, expt: *i32) f64 {
const k = 1799; // reduction constant
const kln2 = 1246.97177782734161156; // k * ln2
@@ -54,7 +54,7 @@ fn frexp_exp64(x: f64, expt: &i32) f64 {
return @bitCast(f64, (u64(high_word) << 32) | lx);
}
-fn ldexp_cexp64(z: &const Complex(f64), expt: i32) Complex(f64) {
+fn ldexp_cexp64(z: *const Complex(f64), expt: i32) Complex(f64) {
var ex_expt: i32 = undefined;
const exp_x = frexp_exp64(z.re, &ex_expt);
const exptf = i64(expt + ex_expt);
diff --git a/std/math/complex/pow.zig b/std/math/complex/pow.zig
index bef9fde542..4c2cd9cf34 100644
--- a/std/math/complex/pow.zig
+++ b/std/math/complex/pow.zig
@@ -4,7 +4,7 @@ const math = std.math;
const cmath = math.complex;
const Complex = cmath.Complex;
-pub fn pow(comptime T: type, z: &const T, c: &const T) T {
+pub fn pow(comptime T: type, z: *const T, c: *const T) T {
const p = cmath.log(z);
const q = c.mul(p);
return cmath.exp(q);
diff --git a/std/math/complex/sinh.zig b/std/math/complex/sinh.zig
index 09a62ca058..3d196bfd50 100644
--- a/std/math/complex/sinh.zig
+++ b/std/math/complex/sinh.zig
@@ -15,7 +15,7 @@ pub fn sinh(z: var) Complex(@typeOf(z.re)) {
};
}
-fn sinh32(z: &const Complex(f32)) Complex(f32) {
+fn sinh32(z: *const Complex(f32)) Complex(f32) {
const x = z.re;
const y = z.im;
@@ -78,7 +78,7 @@ fn sinh32(z: &const Complex(f32)) Complex(f32) {
return Complex(f32).new((x * x) * (y - y), (x + x) * (y - y));
}
-fn sinh64(z: &const Complex(f64)) Complex(f64) {
+fn sinh64(z: *const Complex(f64)) Complex(f64) {
const x = z.re;
const y = z.im;
diff --git a/std/math/complex/sqrt.zig b/std/math/complex/sqrt.zig
index afda69f7c9..d4f5a67528 100644
--- a/std/math/complex/sqrt.zig
+++ b/std/math/complex/sqrt.zig
@@ -15,7 +15,7 @@ pub fn sqrt(z: var) Complex(@typeOf(z.re)) {
};
}
-fn sqrt32(z: &const Complex(f32)) Complex(f32) {
+fn sqrt32(z: *const Complex(f32)) Complex(f32) {
const x = z.re;
const y = z.im;
@@ -57,7 +57,7 @@ fn sqrt32(z: &const Complex(f32)) Complex(f32) {
}
}
-fn sqrt64(z: &const Complex(f64)) Complex(f64) {
+fn sqrt64(z: *const Complex(f64)) Complex(f64) {
// may encounter overflow for im,re >= DBL_MAX / (1 + sqrt(2))
const threshold = 0x1.a827999fcef32p+1022;
diff --git a/std/math/complex/tanh.zig b/std/math/complex/tanh.zig
index 34250b1b4a..1d754838a3 100644
--- a/std/math/complex/tanh.zig
+++ b/std/math/complex/tanh.zig
@@ -13,7 +13,7 @@ pub fn tanh(z: var) Complex(@typeOf(z.re)) {
};
}
-fn tanh32(z: &const Complex(f32)) Complex(f32) {
+fn tanh32(z: *const Complex(f32)) Complex(f32) {
const x = z.re;
const y = z.im;
@@ -51,7 +51,7 @@ fn tanh32(z: &const Complex(f32)) Complex(f32) {
return Complex(f32).new((beta * rho * s) / den, t / den);
}
-fn tanh64(z: &const Complex(f64)) Complex(f64) {
+fn tanh64(z: *const Complex(f64)) Complex(f64) {
const x = z.re;
const y = z.im;
diff --git a/std/math/hypot.zig b/std/math/hypot.zig
index fe0de3a1ea..494df22ba6 100644
--- a/std/math/hypot.zig
+++ b/std/math/hypot.zig
@@ -52,7 +52,7 @@ fn hypot32(x: f32, y: f32) f32 {
return z * math.sqrt(f32(f64(x) * x + f64(y) * y));
}
-fn sq(hi: &f64, lo: &f64, x: f64) void {
+fn sq(hi: *f64, lo: *f64, x: f64) void {
const split: f64 = 0x1.0p27 + 1.0;
const xc = x * split;
const xh = x - xc + xc;
diff --git a/std/math/index.zig b/std/math/index.zig
index 847e972500..33bc1082f7 100644
--- a/std/math/index.zig
+++ b/std/math/index.zig
@@ -46,12 +46,12 @@ pub fn forceEval(value: var) void {
switch (T) {
f32 => {
var x: f32 = undefined;
- const p = @ptrCast(&volatile f32, &x);
+ const p = @ptrCast(*volatile f32, &x);
p.* = x;
},
f64 => {
var x: f64 = undefined;
- const p = @ptrCast(&volatile f64, &x);
+ const p = @ptrCast(*volatile f64, &x);
p.* = x;
},
else => {