Alternative 1 | |
---|---|
Error | 1.0 |
Cost | 64 |
\[z
\]
(FPCore (x y z) :precision binary64 (sqrt (+ (+ (* x x) (* y y)) (* z z))))
(FPCore (x y z) :precision binary64 (hypot y z))
double code(double x, double y, double z) { return sqrt((((x * x) + (y * y)) + (z * z))); }
double code(double x, double y, double z) { return hypot(y, z); }
public static double code(double x, double y, double z) { return Math.sqrt((((x * x) + (y * y)) + (z * z))); }
public static double code(double x, double y, double z) { return Math.hypot(y, z); }
def code(x, y, z): return math.sqrt((((x * x) + (y * y)) + (z * z)))
def code(x, y, z): return math.hypot(y, z)
function code(x, y, z) return sqrt(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(z * z))) end
function code(x, y, z) return hypot(y, z) end
function tmp = code(x, y, z) tmp = sqrt((((x * x) + (y * y)) + (z * z))); end
function tmp = code(x, y, z) tmp = hypot(y, z); end
code[x_, y_, z_] := N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_, y_, z_] := N[Sqrt[y ^ 2 + z ^ 2], $MachinePrecision]
\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}
\mathsf{hypot}\left(y, z\right)
Results
Initial program 38.2
Applied egg-rr0.0
Taylor expanded in x around 0 0.0
Final simplification0.0
Alternative 1 | |
---|---|
Error | 1.0 |
Cost | 64 |
herbie shell --seed 1
(FPCore (x y z)
:name "sqrt(x*x + y*y + z*z)"
:precision binary64
:pre (and (and (and (<= 0.0 x) (<= x 1.79e+308)) (and (<= 0.0 y) (<= y 1.79e+308))) (and (<= 0.0 z) (<= z 1.79e+308)))
(sqrt (+ (+ (* x x) (* y y)) (* z z))))