
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(let* ((t_0 (/ (pow z_m 2.0) y)))
(if (<= (* z_m z_m) 2e-30)
(*
0.5
(fma
-1.0
t_0
(+ (* (+ z_m y) (/ (- y z_m) y)) (+ t_0 (/ (pow x 2.0) y)))))
(if (<= (* z_m z_m) 1e+296)
(*
0.5
(*
(pow z_m 2.0)
(+ (/ y (pow z_m 2.0)) (fma (/ x y) (/ x (pow z_m 2.0)) (/ -1.0 y)))))
(+ (* (/ (* z_m (/ z_m y)) y) (* y -0.5)) (* 0.5 y))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double t_0 = pow(z_m, 2.0) / y;
double tmp;
if ((z_m * z_m) <= 2e-30) {
tmp = 0.5 * fma(-1.0, t_0, (((z_m + y) * ((y - z_m) / y)) + (t_0 + (pow(x, 2.0) / y))));
} else if ((z_m * z_m) <= 1e+296) {
tmp = 0.5 * (pow(z_m, 2.0) * ((y / pow(z_m, 2.0)) + fma((x / y), (x / pow(z_m, 2.0)), (-1.0 / y))));
} else {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m) t_0 = Float64((z_m ^ 2.0) / y) tmp = 0.0 if (Float64(z_m * z_m) <= 2e-30) tmp = Float64(0.5 * fma(-1.0, t_0, Float64(Float64(Float64(z_m + y) * Float64(Float64(y - z_m) / y)) + Float64(t_0 + Float64((x ^ 2.0) / y))))); elseif (Float64(z_m * z_m) <= 1e+296) tmp = Float64(0.5 * Float64((z_m ^ 2.0) * Float64(Float64(y / (z_m ^ 2.0)) + fma(Float64(x / y), Float64(x / (z_m ^ 2.0)), Float64(-1.0 / y))))); else tmp = Float64(Float64(Float64(Float64(z_m * Float64(z_m / y)) / y) * Float64(y * -0.5)) + Float64(0.5 * y)); end return tmp end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[Power[z$95$m, 2.0], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 2e-30], N[(0.5 * N[(-1.0 * t$95$0 + N[(N[(N[(z$95$m + y), $MachinePrecision] * N[(N[(y - z$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 + N[(N[Power[x, 2.0], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+296], N[(0.5 * N[(N[Power[z$95$m, 2.0], $MachinePrecision] * N[(N[(y / N[Power[z$95$m, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] * N[(x / N[Power[z$95$m, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_0 := \frac{{z\_m}^{2}}{y}\\
\mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{-30}:\\
\;\;\;\;0.5 \cdot \mathsf{fma}\left(-1, t\_0, \left(z\_m + y\right) \cdot \frac{y - z\_m}{y} + \left(t\_0 + \frac{{x}^{2}}{y}\right)\right)\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 10^{+296}:\\
\;\;\;\;0.5 \cdot \left({z\_m}^{2} \cdot \left(\frac{y}{{z\_m}^{2}} + \mathsf{fma}\left(\frac{x}{y}, \frac{x}{{z\_m}^{2}}, \frac{-1}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m \cdot \frac{z\_m}{y}}{y} \cdot \left(y \cdot -0.5\right) + 0.5 \cdot y\\
\end{array}
\end{array}
if (*.f64 z z) < 2e-30Initial program 80.5%
remove-double-neg80.5%
distribute-lft-neg-out80.5%
distribute-frac-neg280.5%
distribute-frac-neg80.5%
neg-mul-180.5%
distribute-lft-neg-out80.5%
*-commutative80.5%
distribute-lft-neg-in80.5%
times-frac80.5%
metadata-eval80.5%
metadata-eval80.5%
associate--l+80.5%
fma-define80.5%
Simplified80.5%
prod-diff80.5%
fma-neg80.5%
difference-of-squares80.5%
fma-define80.5%
pow280.5%
Applied egg-rr80.5%
Taylor expanded in x around 0 80.5%
fma-define80.5%
associate-/l*96.9%
+-commutative96.9%
Simplified96.9%
if 2e-30 < (*.f64 z z) < 9.99999999999999981e295Initial program 83.5%
remove-double-neg83.5%
distribute-lft-neg-out83.5%
distribute-frac-neg283.5%
distribute-frac-neg83.5%
neg-mul-183.5%
distribute-lft-neg-out83.5%
*-commutative83.5%
distribute-lft-neg-in83.5%
times-frac83.5%
metadata-eval83.5%
metadata-eval83.5%
associate--l+83.5%
fma-define83.5%
Simplified83.5%
Taylor expanded in z around inf 91.8%
associate--l+91.8%
unpow291.8%
times-frac98.1%
fma-neg98.1%
distribute-neg-frac98.1%
metadata-eval98.1%
Simplified98.1%
if 9.99999999999999981e295 < (*.f64 z z) Initial program 48.1%
Taylor expanded in y around inf 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in x around 0 60.8%
*-commutative60.8%
Simplified60.8%
+-commutative60.8%
distribute-rgt-in60.8%
associate-*l*60.8%
add-sqr-sqrt60.8%
pow260.8%
sqrt-div60.8%
sqrt-pow181.4%
metadata-eval81.4%
pow181.4%
sqrt-pow193.6%
metadata-eval93.6%
pow193.6%
Applied egg-rr93.6%
unpow293.6%
associate-*r/93.7%
Applied egg-rr93.7%
Final simplification96.4%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* 2.0 y))))
(if (<= t_0 1e+289)
(* 0.5 (/ (fma x x (- (* y y) (* z_m z_m))) y))
(if (<= t_0 INFINITY)
(* 0.5 (+ y (* x (* x (/ 1.0 y)))))
(+ (* (/ (* z_m (/ z_m y)) y) (* y -0.5)) (* 0.5 y))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (2.0 * y);
double tmp;
if (t_0 <= 1e+289) {
tmp = 0.5 * (fma(x, x, ((y * y) - (z_m * z_m))) / y);
} else if (t_0 <= ((double) INFINITY)) {
tmp = 0.5 * (y + (x * (x * (1.0 / y))));
} else {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(2.0 * y)) tmp = 0.0 if (t_0 <= 1e+289) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y * y) - Float64(z_m * z_m))) / y)); elseif (t_0 <= Inf) tmp = Float64(0.5 * Float64(y + Float64(x * Float64(x * Float64(1.0 / y))))); else tmp = Float64(Float64(Float64(Float64(z_m * Float64(z_m / y)) / y) * Float64(y * -0.5)) + Float64(0.5 * y)); end return tmp end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(2.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+289], N[(0.5 * N[(N[(x * x + N[(N[(y * y), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(0.5 * N[(y + N[(x * N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{2 \cdot y}\\
\mathbf{if}\;t\_0 \leq 10^{+289}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y \cdot y - z\_m \cdot z\_m\right)}{y}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \left(x \cdot \frac{1}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m \cdot \frac{z\_m}{y}}{y} \cdot \left(y \cdot -0.5\right) + 0.5 \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 1.0000000000000001e289Initial program 87.6%
remove-double-neg87.6%
distribute-lft-neg-out87.6%
distribute-frac-neg287.6%
distribute-frac-neg87.6%
neg-mul-187.6%
distribute-lft-neg-out87.6%
*-commutative87.6%
distribute-lft-neg-in87.6%
times-frac87.6%
metadata-eval87.6%
metadata-eval87.6%
associate--l+87.6%
fma-define87.6%
Simplified87.6%
if 1.0000000000000001e289 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0Initial program 71.9%
Taylor expanded in z around 0 35.6%
associate-*r/35.6%
rem-square-sqrt35.6%
unpow235.6%
unpow235.6%
hypot-undefine35.6%
unpow235.6%
unpow235.6%
hypot-undefine35.6%
unpow235.6%
associate-*l/35.6%
*-commutative35.6%
Simplified35.6%
Taylor expanded in x around 0 56.8%
distribute-lft-out56.8%
Simplified56.8%
div-inv56.8%
unpow256.8%
associate-*l*62.3%
Applied egg-rr62.3%
if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 0.0%
Taylor expanded in y around inf 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in x around 0 26.7%
*-commutative26.7%
Simplified26.7%
+-commutative26.7%
distribute-rgt-in26.7%
associate-*l*26.7%
add-sqr-sqrt26.7%
pow226.7%
sqrt-div26.7%
sqrt-pow161.1%
metadata-eval61.1%
pow161.1%
sqrt-pow186.7%
metadata-eval86.7%
pow186.7%
Applied egg-rr86.7%
unpow286.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification81.0%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y y)) (* z_m z_m)) (* 2.0 y))))
(if (<= t_0 1e+289)
t_0
(if (<= t_0 INFINITY)
(* 0.5 (+ y (* x (* x (/ 1.0 y)))))
(+ (* (/ (* z_m (/ z_m y)) y) (* y -0.5)) (* 0.5 y))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (2.0 * y);
double tmp;
if (t_0 <= 1e+289) {
tmp = t_0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = 0.5 * (y + (x * (x * (1.0 / y))));
} else {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
}
return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (2.0 * y);
double tmp;
if (t_0 <= 1e+289) {
tmp = t_0;
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = 0.5 * (y + (x * (x * (1.0 / y))));
} else {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (2.0 * y) tmp = 0 if t_0 <= 1e+289: tmp = t_0 elif t_0 <= math.inf: tmp = 0.5 * (y + (x * (x * (1.0 / y)))) else: tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y) return tmp
z_m = abs(z) function code(x, y, z_m) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z_m * z_m)) / Float64(2.0 * y)) tmp = 0.0 if (t_0 <= 1e+289) tmp = t_0; elseif (t_0 <= Inf) tmp = Float64(0.5 * Float64(y + Float64(x * Float64(x * Float64(1.0 / y))))); else tmp = Float64(Float64(Float64(Float64(z_m * Float64(z_m / y)) / y) * Float64(y * -0.5)) + Float64(0.5 * y)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) t_0 = (((x * x) + (y * y)) - (z_m * z_m)) / (2.0 * y); tmp = 0.0; if (t_0 <= 1e+289) tmp = t_0; elseif (t_0 <= Inf) tmp = 0.5 * (y + (x * (x * (1.0 / y)))); else tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] / N[(2.0 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+289], t$95$0, If[LessEqual[t$95$0, Infinity], N[(0.5 * N[(y + N[(x * N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y \cdot y\right) - z\_m \cdot z\_m}{2 \cdot y}\\
\mathbf{if}\;t\_0 \leq 10^{+289}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \left(x \cdot \frac{1}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m \cdot \frac{z\_m}{y}}{y} \cdot \left(y \cdot -0.5\right) + 0.5 \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 1.0000000000000001e289Initial program 87.6%
if 1.0000000000000001e289 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0Initial program 71.9%
Taylor expanded in z around 0 35.6%
associate-*r/35.6%
rem-square-sqrt35.6%
unpow235.6%
unpow235.6%
hypot-undefine35.6%
unpow235.6%
unpow235.6%
hypot-undefine35.6%
unpow235.6%
associate-*l/35.6%
*-commutative35.6%
Simplified35.6%
Taylor expanded in x around 0 56.8%
distribute-lft-out56.8%
Simplified56.8%
div-inv56.8%
unpow256.8%
associate-*l*62.3%
Applied egg-rr62.3%
if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 0.0%
Taylor expanded in y around inf 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in x around 0 26.7%
*-commutative26.7%
Simplified26.7%
+-commutative26.7%
distribute-rgt-in26.7%
associate-*l*26.7%
add-sqr-sqrt26.7%
pow226.7%
sqrt-div26.7%
sqrt-pow161.1%
metadata-eval61.1%
pow161.1%
sqrt-pow186.7%
metadata-eval86.7%
pow186.7%
Applied egg-rr86.7%
unpow286.7%
associate-*r/86.8%
Applied egg-rr86.8%
Final simplification81.0%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(if (<= z_m 5.1e-20)
(* 0.5 (+ y (/ (/ x y) (/ 1.0 x))))
(if (or (<= z_m 4.7e+20) (not (<= z_m 1e+36)))
(+ (* (/ (* z_m (/ z_m y)) y) (* y -0.5)) (* 0.5 y))
(* 0.5 (+ y (/ x (/ y x)))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.1e-20) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 4.7e+20) || !(z_m <= 1e+36)) {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5.1d-20) then
tmp = 0.5d0 * (y + ((x / y) / (1.0d0 / x)))
else if ((z_m <= 4.7d+20) .or. (.not. (z_m <= 1d+36))) then
tmp = (((z_m * (z_m / y)) / y) * (y * (-0.5d0))) + (0.5d0 * y)
else
tmp = 0.5d0 * (y + (x / (y / x)))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.1e-20) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 4.7e+20) || !(z_m <= 1e+36)) {
tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y);
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 5.1e-20: tmp = 0.5 * (y + ((x / y) / (1.0 / x))) elif (z_m <= 4.7e+20) or not (z_m <= 1e+36): tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y) else: tmp = 0.5 * (y + (x / (y / x))) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 5.1e-20) tmp = Float64(0.5 * Float64(y + Float64(Float64(x / y) / Float64(1.0 / x)))); elseif ((z_m <= 4.7e+20) || !(z_m <= 1e+36)) tmp = Float64(Float64(Float64(Float64(z_m * Float64(z_m / y)) / y) * Float64(y * -0.5)) + Float64(0.5 * y)); else tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 5.1e-20) tmp = 0.5 * (y + ((x / y) / (1.0 / x))); elseif ((z_m <= 4.7e+20) || ~((z_m <= 1e+36))) tmp = (((z_m * (z_m / y)) / y) * (y * -0.5)) + (0.5 * y); else tmp = 0.5 * (y + (x / (y / x))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.1e-20], N[(0.5 * N[(y + N[(N[(x / y), $MachinePrecision] / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z$95$m, 4.7e+20], N[Not[LessEqual[z$95$m, 1e+36]], $MachinePrecision]], N[(N[(N[(N[(z$95$m * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] + N[(0.5 * y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 5.1 \cdot 10^{-20}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{\frac{x}{y}}{\frac{1}{x}}\right)\\
\mathbf{elif}\;z\_m \leq 4.7 \cdot 10^{+20} \lor \neg \left(z\_m \leq 10^{+36}\right):\\
\;\;\;\;\frac{z\_m \cdot \frac{z\_m}{y}}{y} \cdot \left(y \cdot -0.5\right) + 0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if z < 5.10000000000000019e-20Initial program 74.5%
Taylor expanded in z around 0 55.5%
associate-*r/55.5%
rem-square-sqrt55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in x around 0 70.2%
distribute-lft-out70.2%
Simplified70.2%
unpow270.2%
*-un-lft-identity70.2%
times-frac73.7%
Applied egg-rr73.7%
clear-num73.7%
associate-*l/73.7%
*-un-lft-identity73.7%
Applied egg-rr73.7%
if 5.10000000000000019e-20 < z < 4.7e20 or 1.00000000000000004e36 < z Initial program 68.1%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
Simplified71.8%
+-commutative71.8%
distribute-rgt-in71.8%
associate-*l*71.8%
add-sqr-sqrt71.7%
pow271.7%
sqrt-div71.7%
sqrt-pow180.7%
metadata-eval80.7%
pow180.7%
sqrt-pow185.3%
metadata-eval85.3%
pow185.3%
Applied egg-rr85.3%
unpow285.3%
associate-*r/85.4%
Applied egg-rr85.4%
if 4.7e20 < z < 1.00000000000000004e36Initial program 99.5%
Taylor expanded in z around 0 99.5%
associate-*r/99.5%
rem-square-sqrt99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
distribute-lft-out99.5%
Simplified99.5%
unpow299.5%
*-un-lft-identity99.5%
times-frac99.5%
Applied egg-rr99.5%
/-rgt-identity99.5%
clear-num99.5%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification76.7%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(if (<= z_m 5.2e-21)
(* 0.5 (+ y (/ (/ x y) (/ 1.0 x))))
(if (or (<= z_m 4.4e+19) (not (<= z_m 2.05e+36)))
(+ (* 0.5 y) (* (* y -0.5) (/ z_m (* y (/ y z_m)))))
(* 0.5 (+ y (/ x (/ y x)))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.2e-21) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 4.4e+19) || !(z_m <= 2.05e+36)) {
tmp = (0.5 * y) + ((y * -0.5) * (z_m / (y * (y / z_m))));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5.2d-21) then
tmp = 0.5d0 * (y + ((x / y) / (1.0d0 / x)))
else if ((z_m <= 4.4d+19) .or. (.not. (z_m <= 2.05d+36))) then
tmp = (0.5d0 * y) + ((y * (-0.5d0)) * (z_m / (y * (y / z_m))))
else
tmp = 0.5d0 * (y + (x / (y / x)))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.2e-21) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 4.4e+19) || !(z_m <= 2.05e+36)) {
tmp = (0.5 * y) + ((y * -0.5) * (z_m / (y * (y / z_m))));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 5.2e-21: tmp = 0.5 * (y + ((x / y) / (1.0 / x))) elif (z_m <= 4.4e+19) or not (z_m <= 2.05e+36): tmp = (0.5 * y) + ((y * -0.5) * (z_m / (y * (y / z_m)))) else: tmp = 0.5 * (y + (x / (y / x))) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 5.2e-21) tmp = Float64(0.5 * Float64(y + Float64(Float64(x / y) / Float64(1.0 / x)))); elseif ((z_m <= 4.4e+19) || !(z_m <= 2.05e+36)) tmp = Float64(Float64(0.5 * y) + Float64(Float64(y * -0.5) * Float64(z_m / Float64(y * Float64(y / z_m))))); else tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 5.2e-21) tmp = 0.5 * (y + ((x / y) / (1.0 / x))); elseif ((z_m <= 4.4e+19) || ~((z_m <= 2.05e+36))) tmp = (0.5 * y) + ((y * -0.5) * (z_m / (y * (y / z_m)))); else tmp = 0.5 * (y + (x / (y / x))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.2e-21], N[(0.5 * N[(y + N[(N[(x / y), $MachinePrecision] / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z$95$m, 4.4e+19], N[Not[LessEqual[z$95$m, 2.05e+36]], $MachinePrecision]], N[(N[(0.5 * y), $MachinePrecision] + N[(N[(y * -0.5), $MachinePrecision] * N[(z$95$m / N[(y * N[(y / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 5.2 \cdot 10^{-21}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{\frac{x}{y}}{\frac{1}{x}}\right)\\
\mathbf{elif}\;z\_m \leq 4.4 \cdot 10^{+19} \lor \neg \left(z\_m \leq 2.05 \cdot 10^{+36}\right):\\
\;\;\;\;0.5 \cdot y + \left(y \cdot -0.5\right) \cdot \frac{z\_m}{y \cdot \frac{y}{z\_m}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if z < 5.20000000000000035e-21Initial program 74.5%
Taylor expanded in z around 0 55.5%
associate-*r/55.5%
rem-square-sqrt55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in x around 0 70.2%
distribute-lft-out70.2%
Simplified70.2%
unpow270.2%
*-un-lft-identity70.2%
times-frac73.7%
Applied egg-rr73.7%
clear-num73.7%
associate-*l/73.7%
*-un-lft-identity73.7%
Applied egg-rr73.7%
if 5.20000000000000035e-21 < z < 4.4e19 or 2.05000000000000006e36 < z Initial program 68.1%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
Simplified71.8%
+-commutative71.8%
distribute-rgt-in71.8%
associate-*l*71.8%
add-sqr-sqrt71.7%
pow271.7%
sqrt-div71.7%
sqrt-pow180.7%
metadata-eval80.7%
pow180.7%
sqrt-pow185.3%
metadata-eval85.3%
pow185.3%
Applied egg-rr85.3%
unpow285.3%
clear-num85.4%
frac-times85.4%
*-un-lft-identity85.4%
Applied egg-rr85.4%
if 4.4e19 < z < 2.05000000000000006e36Initial program 99.5%
Taylor expanded in z around 0 99.5%
associate-*r/99.5%
rem-square-sqrt99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
distribute-lft-out99.5%
Simplified99.5%
unpow299.5%
*-un-lft-identity99.5%
times-frac99.5%
Applied egg-rr99.5%
/-rgt-identity99.5%
clear-num99.5%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification76.7%
z_m = (fabs.f64 z)
(FPCore (x y z_m)
:precision binary64
(if (<= z_m 5.1e-20)
(* 0.5 (+ y (/ (/ x y) (/ 1.0 x))))
(if (or (<= z_m 6.2e+20) (not (<= z_m 1.15e+36)))
(* y (+ 0.5 (* -0.5 (* (/ z_m y) (/ z_m y)))))
(* 0.5 (+ y (/ x (/ y x)))))))z_m = fabs(z);
double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.1e-20) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 6.2e+20) || !(z_m <= 1.15e+36)) {
tmp = y * (0.5 + (-0.5 * ((z_m / y) * (z_m / y))));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8) :: tmp
if (z_m <= 5.1d-20) then
tmp = 0.5d0 * (y + ((x / y) / (1.0d0 / x)))
else if ((z_m <= 6.2d+20) .or. (.not. (z_m <= 1.15d+36))) then
tmp = y * (0.5d0 + ((-0.5d0) * ((z_m / y) * (z_m / y))))
else
tmp = 0.5d0 * (y + (x / (y / x)))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
double tmp;
if (z_m <= 5.1e-20) {
tmp = 0.5 * (y + ((x / y) / (1.0 / x)));
} else if ((z_m <= 6.2e+20) || !(z_m <= 1.15e+36)) {
tmp = y * (0.5 + (-0.5 * ((z_m / y) * (z_m / y))));
} else {
tmp = 0.5 * (y + (x / (y / x)));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m): tmp = 0 if z_m <= 5.1e-20: tmp = 0.5 * (y + ((x / y) / (1.0 / x))) elif (z_m <= 6.2e+20) or not (z_m <= 1.15e+36): tmp = y * (0.5 + (-0.5 * ((z_m / y) * (z_m / y)))) else: tmp = 0.5 * (y + (x / (y / x))) return tmp
z_m = abs(z) function code(x, y, z_m) tmp = 0.0 if (z_m <= 5.1e-20) tmp = Float64(0.5 * Float64(y + Float64(Float64(x / y) / Float64(1.0 / x)))); elseif ((z_m <= 6.2e+20) || !(z_m <= 1.15e+36)) tmp = Float64(y * Float64(0.5 + Float64(-0.5 * Float64(Float64(z_m / y) * Float64(z_m / y))))); else tmp = Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m) tmp = 0.0; if (z_m <= 5.1e-20) tmp = 0.5 * (y + ((x / y) / (1.0 / x))); elseif ((z_m <= 6.2e+20) || ~((z_m <= 1.15e+36))) tmp = y * (0.5 + (-0.5 * ((z_m / y) * (z_m / y)))); else tmp = 0.5 * (y + (x / (y / x))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := If[LessEqual[z$95$m, 5.1e-20], N[(0.5 * N[(y + N[(N[(x / y), $MachinePrecision] / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z$95$m, 6.2e+20], N[Not[LessEqual[z$95$m, 1.15e+36]], $MachinePrecision]], N[(y * N[(0.5 + N[(-0.5 * N[(N[(z$95$m / y), $MachinePrecision] * N[(z$95$m / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 5.1 \cdot 10^{-20}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{\frac{x}{y}}{\frac{1}{x}}\right)\\
\mathbf{elif}\;z\_m \leq 6.2 \cdot 10^{+20} \lor \neg \left(z\_m \leq 1.15 \cdot 10^{+36}\right):\\
\;\;\;\;y \cdot \left(0.5 + -0.5 \cdot \left(\frac{z\_m}{y} \cdot \frac{z\_m}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)\\
\end{array}
\end{array}
if z < 5.10000000000000019e-20Initial program 74.5%
Taylor expanded in z around 0 55.5%
associate-*r/55.5%
rem-square-sqrt55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
unpow255.5%
hypot-undefine55.5%
unpow255.5%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in x around 0 70.2%
distribute-lft-out70.2%
Simplified70.2%
unpow270.2%
*-un-lft-identity70.2%
times-frac73.7%
Applied egg-rr73.7%
clear-num73.7%
associate-*l/73.7%
*-un-lft-identity73.7%
Applied egg-rr73.7%
if 5.10000000000000019e-20 < z < 6.2e20 or 1.14999999999999998e36 < z Initial program 68.1%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
Simplified71.8%
unpow271.8%
unpow271.8%
times-frac85.3%
Applied egg-rr85.3%
if 6.2e20 < z < 1.14999999999999998e36Initial program 99.5%
Taylor expanded in z around 0 99.5%
associate-*r/99.5%
rem-square-sqrt99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
unpow299.5%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
distribute-lft-out99.5%
Simplified99.5%
unpow299.5%
*-un-lft-identity99.5%
times-frac99.5%
Applied egg-rr99.5%
/-rgt-identity99.5%
clear-num99.5%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification76.7%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* 0.5 (+ y (/ (/ x y) (/ 1.0 x)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 * (y + ((x / y) / (1.0 / x)));
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = 0.5d0 * (y + ((x / y) / (1.0d0 / x)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 * (y + ((x / y) / (1.0 / x)));
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 * (y + ((x / y) / (1.0 / x)))
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 * Float64(y + Float64(Float64(x / y) / Float64(1.0 / x)))) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 * (y + ((x / y) / (1.0 / x))); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 * N[(y + N[(N[(x / y), $MachinePrecision] / N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
0.5 \cdot \left(y + \frac{\frac{x}{y}}{\frac{1}{x}}\right)
\end{array}
Initial program 73.3%
Taylor expanded in z around 0 47.3%
associate-*r/47.3%
rem-square-sqrt47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
associate-*l/47.2%
*-commutative47.2%
Simplified47.2%
Taylor expanded in x around 0 61.1%
distribute-lft-out61.1%
Simplified61.1%
unpow261.1%
*-un-lft-identity61.1%
times-frac64.4%
Applied egg-rr64.4%
clear-num64.4%
associate-*l/64.4%
*-un-lft-identity64.4%
Applied egg-rr64.4%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* 0.5 (+ y (/ x (/ y x)))))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 * (y + (x / (y / x)));
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = 0.5d0 * (y + (x / (y / x)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 * (y + (x / (y / x)));
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 * (y + (x / (y / x)))
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 * Float64(y + Float64(x / Float64(y / x)))) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 * (y + (x / (y / x))); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 * N[(y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
0.5 \cdot \left(y + \frac{x}{\frac{y}{x}}\right)
\end{array}
Initial program 73.3%
Taylor expanded in z around 0 47.3%
associate-*r/47.3%
rem-square-sqrt47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
associate-*l/47.2%
*-commutative47.2%
Simplified47.2%
Taylor expanded in x around 0 61.1%
distribute-lft-out61.1%
Simplified61.1%
unpow261.1%
*-un-lft-identity61.1%
times-frac64.4%
Applied egg-rr64.4%
/-rgt-identity64.4%
clear-num64.4%
un-div-inv64.4%
Applied egg-rr64.4%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* 0.5 y))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return 0.5 * y;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = 0.5d0 * y
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return 0.5 * y;
}
z_m = math.fabs(z) def code(x, y, z_m): return 0.5 * y
z_m = abs(z) function code(x, y, z_m) return Float64(0.5 * y) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = 0.5 * y; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
0.5 \cdot y
\end{array}
Initial program 73.3%
Taylor expanded in y around inf 34.0%
*-commutative34.0%
Simplified34.0%
Final simplification34.0%
z_m = (fabs.f64 z) (FPCore (x y z_m) :precision binary64 (* y -0.5))
z_m = fabs(z);
double code(double x, double y, double z_m) {
return y * -0.5;
}
z_m = abs(z)
real(8) function code(x, y, z_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
code = y * (-0.5d0)
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m) {
return y * -0.5;
}
z_m = math.fabs(z) def code(x, y, z_m): return y * -0.5
z_m = abs(z) function code(x, y, z_m) return Float64(y * -0.5) end
z_m = abs(z); function tmp = code(x, y, z_m) tmp = y * -0.5; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_] := N[(y * -0.5), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
y \cdot -0.5
\end{array}
Initial program 73.3%
clear-num73.2%
inv-pow73.2%
associate-/l*72.8%
add-sqr-sqrt72.8%
pow272.8%
hypot-define72.8%
pow272.8%
Applied egg-rr72.8%
unpow-172.8%
associate-*r/73.2%
Simplified73.2%
Taylor expanded in y around inf 33.9%
add-sqr-sqrt18.6%
sqrt-unprod13.1%
associate-/r/13.1%
metadata-eval13.1%
associate-/r/13.1%
metadata-eval13.1%
swap-sqr13.1%
metadata-eval13.1%
metadata-eval13.1%
swap-sqr13.1%
sqrt-unprod0.9%
add-sqr-sqrt1.9%
*-commutative1.9%
Applied egg-rr1.9%
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2024085
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))