Alternative 1 | |
---|---|
Error | 0.4 |
Cost | 13120 |
\[{\left(\frac{\mathsf{hypot}\left(x, y\right)}{z}\right)}^{2}
\]
(FPCore (x y z) :precision binary64 (/ (/ (+ (* x x) (* y y)) z) z))
(FPCore (x y z) :precision binary64 (/ (/ (hypot x y) z) (/ z (hypot x y))))
double code(double x, double y, double z) { return (((x * x) + (y * y)) / z) / z; }
double code(double x, double y, double z) { return (hypot(x, y) / z) / (z / hypot(x, y)); }
public static double code(double x, double y, double z) { return (((x * x) + (y * y)) / z) / z; }
public static double code(double x, double y, double z) { return (Math.hypot(x, y) / z) / (z / Math.hypot(x, y)); }
def code(x, y, z): return (((x * x) + (y * y)) / z) / z
def code(x, y, z): return (math.hypot(x, y) / z) / (z / math.hypot(x, y))
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) / z) / z) end
function code(x, y, z) return Float64(Float64(hypot(x, y) / z) / Float64(z / hypot(x, y))) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) / z) / z; end
function tmp = code(x, y, z) tmp = (hypot(x, y) / z) / (z / hypot(x, y)); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision]
code[x_, y_, z_] := N[(N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] / z), $MachinePrecision] / N[(z / N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\frac{x \cdot x + y \cdot y}{z}}{z}
\frac{\frac{\mathsf{hypot}\left(x, y\right)}{z}}{\frac{z}{\mathsf{hypot}\left(x, y\right)}}
Results
Initial program 20.3
Applied egg-rr22.1
Simplified0.4
[Start]22.1 | \[ e^{\mathsf{log1p}\left({\left(\frac{\mathsf{hypot}\left(x, y\right)}{z}\right)}^{2}\right)} - 1
\] |
---|---|
expm1-def [=>]2.7 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{\mathsf{hypot}\left(x, y\right)}{z}\right)}^{2}\right)\right)}
\] |
expm1-log1p [=>]0.4 | \[ \color{blue}{{\left(\frac{\mathsf{hypot}\left(x, y\right)}{z}\right)}^{2}}
\] |
Applied egg-rr0.3
Final simplification0.3
Alternative 1 | |
---|---|
Error | 0.4 |
Cost | 13120 |
Alternative 2 | |
---|---|
Error | 16.9 |
Cost | 968 |
Alternative 3 | |
---|---|
Error | 15.4 |
Cost | 968 |
Alternative 4 | |
---|---|
Error | 0.4 |
Cost | 960 |
Alternative 5 | |
---|---|
Error | 17.7 |
Cost | 580 |
Alternative 6 | |
---|---|
Error | 17.7 |
Cost | 580 |
Alternative 7 | |
---|---|
Error | 24.2 |
Cost | 448 |
herbie shell --seed 1
(FPCore (x y z)
:name "(x * x + y * y) / z / z"
:precision binary64
:pre (and (and (and (<= -1.79e+308 x) (<= x 1.79e+308)) (and (<= -1.79e+308 y) (<= y 1.79e+308))) (and (<= -1.79e+308 z) (<= z 1.79e+308)))
(/ (/ (+ (* x x) (* y y)) z) z))