
(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 14 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}
(FPCore (x y z) :precision binary64 (if (or (<= y -6e-133) (not (<= y 3e-230))) (fma (/ (hypot x y) y) (/ (hypot x y) 2.0) (* (/ z y) (/ (- z) 2.0))) (/ 1.0 (* (/ y (- x z)) (/ 2.0 (+ x z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e-133) || !(y <= 3e-230)) {
tmp = fma((hypot(x, y) / y), (hypot(x, y) / 2.0), ((z / y) * (-z / 2.0)));
} else {
tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -6e-133) || !(y <= 3e-230)) tmp = fma(Float64(hypot(x, y) / y), Float64(hypot(x, y) / 2.0), Float64(Float64(z / y) * Float64(Float64(-z) / 2.0))); else tmp = Float64(1.0 / Float64(Float64(y / Float64(x - z)) * Float64(2.0 / Float64(x + z)))); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -6e-133], N[Not[LessEqual[y, 3e-230]], $MachinePrecision]], N[(N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] / y), $MachinePrecision] * N[(N[Sqrt[x ^ 2 + y ^ 2], $MachinePrecision] / 2.0), $MachinePrecision] + N[(N[(z / y), $MachinePrecision] * N[((-z) / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-133} \lor \neg \left(y \leq 3 \cdot 10^{-230}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{hypot}\left(x, y\right)}{y}, \frac{\mathsf{hypot}\left(x, y\right)}{2}, \frac{z}{y} \cdot \frac{-z}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\
\end{array}
\end{array}
if y < -6.00000000000000038e-133 or 3e-230 < y Initial program 62.4%
div-sub60.4%
sub-neg60.4%
add-sqr-sqrt60.4%
times-frac60.5%
fma-def62.5%
hypot-def62.5%
hypot-def88.2%
times-frac98.4%
Applied egg-rr98.4%
if -6.00000000000000038e-133 < y < 3e-230Initial program 93.1%
Taylor expanded in y around 0 91.2%
unpow291.2%
unpow291.2%
Simplified91.2%
clear-num91.2%
inv-pow91.2%
*-commutative91.2%
*-un-lft-identity91.2%
times-frac91.2%
metadata-eval91.2%
Applied egg-rr91.2%
unpow-191.2%
associate-*r/91.2%
*-commutative91.2%
difference-of-squares93.2%
*-commutative93.2%
times-frac96.1%
+-commutative96.1%
Simplified96.1%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.18e+45) (not (<= y 2.2e-217))) (* 0.5 (+ (/ x (/ y x)) (- y (/ z (/ y z))))) (/ (fma x x (* (+ y z) (- y z))) (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.18e+45) || !(y <= 2.2e-217)) {
tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
} else {
tmp = fma(x, x, ((y + z) * (y - z))) / (y * 2.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.18e+45) || !(y <= 2.2e-217)) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(y - Float64(z / Float64(y / z))))); else tmp = Float64(fma(x, x, Float64(Float64(y + z) * Float64(y - z))) / Float64(y * 2.0)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.18e+45], N[Not[LessEqual[y, 2.2e-217]], $MachinePrecision]], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x + N[(N[(y + z), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{+45} \lor \neg \left(y \leq 2.2 \cdot 10^{-217}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, \left(y + z\right) \cdot \left(y - z\right)\right)}{y \cdot 2}\\
\end{array}
\end{array}
if y < -1.17999999999999993e45 or 2.19999999999999982e-217 < y Initial program 53.7%
Taylor expanded in x around inf 75.1%
+-commutative75.1%
distribute-lft-out75.1%
unpow275.1%
associate-/l*82.9%
unpow282.9%
associate-/l*95.7%
Simplified95.7%
if -1.17999999999999993e45 < y < 2.19999999999999982e-217Initial program 95.0%
associate--l+95.0%
fma-def97.2%
difference-of-squares97.2%
Simplified97.2%
Final simplification96.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 0.5 (/ x (/ y x)))))
(if (<= (* z z) 5e+17)
(* y 0.5)
(if (<= (* z z) 1e+73)
t_0
(if (<= (* z z) 1e+196)
(* z (* z (/ -0.5 y)))
(if (<= (* z z) 1e+218)
t_0
(if (<= (* z z) 5e+250)
(* y 0.5)
(if (<= (* z z) 2e+256)
(* (/ x y) (* x 0.5))
(* (/ z y) (* z -0.5))))))))))
double code(double x, double y, double z) {
double t_0 = 0.5 * (x / (y / x));
double tmp;
if ((z * z) <= 5e+17) {
tmp = y * 0.5;
} else if ((z * z) <= 1e+73) {
tmp = t_0;
} else if ((z * z) <= 1e+196) {
tmp = z * (z * (-0.5 / y));
} else if ((z * z) <= 1e+218) {
tmp = t_0;
} else if ((z * z) <= 5e+250) {
tmp = y * 0.5;
} else if ((z * z) <= 2e+256) {
tmp = (x / y) * (x * 0.5);
} else {
tmp = (z / y) * (z * -0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x / (y / x))
if ((z * z) <= 5d+17) then
tmp = y * 0.5d0
else if ((z * z) <= 1d+73) then
tmp = t_0
else if ((z * z) <= 1d+196) then
tmp = z * (z * ((-0.5d0) / y))
else if ((z * z) <= 1d+218) then
tmp = t_0
else if ((z * z) <= 5d+250) then
tmp = y * 0.5d0
else if ((z * z) <= 2d+256) then
tmp = (x / y) * (x * 0.5d0)
else
tmp = (z / y) * (z * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.5 * (x / (y / x));
double tmp;
if ((z * z) <= 5e+17) {
tmp = y * 0.5;
} else if ((z * z) <= 1e+73) {
tmp = t_0;
} else if ((z * z) <= 1e+196) {
tmp = z * (z * (-0.5 / y));
} else if ((z * z) <= 1e+218) {
tmp = t_0;
} else if ((z * z) <= 5e+250) {
tmp = y * 0.5;
} else if ((z * z) <= 2e+256) {
tmp = (x / y) * (x * 0.5);
} else {
tmp = (z / y) * (z * -0.5);
}
return tmp;
}
def code(x, y, z): t_0 = 0.5 * (x / (y / x)) tmp = 0 if (z * z) <= 5e+17: tmp = y * 0.5 elif (z * z) <= 1e+73: tmp = t_0 elif (z * z) <= 1e+196: tmp = z * (z * (-0.5 / y)) elif (z * z) <= 1e+218: tmp = t_0 elif (z * z) <= 5e+250: tmp = y * 0.5 elif (z * z) <= 2e+256: tmp = (x / y) * (x * 0.5) else: tmp = (z / y) * (z * -0.5) return tmp
function code(x, y, z) t_0 = Float64(0.5 * Float64(x / Float64(y / x))) tmp = 0.0 if (Float64(z * z) <= 5e+17) tmp = Float64(y * 0.5); elseif (Float64(z * z) <= 1e+73) tmp = t_0; elseif (Float64(z * z) <= 1e+196) tmp = Float64(z * Float64(z * Float64(-0.5 / y))); elseif (Float64(z * z) <= 1e+218) tmp = t_0; elseif (Float64(z * z) <= 5e+250) tmp = Float64(y * 0.5); elseif (Float64(z * z) <= 2e+256) tmp = Float64(Float64(x / y) * Float64(x * 0.5)); else tmp = Float64(Float64(z / y) * Float64(z * -0.5)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.5 * (x / (y / x)); tmp = 0.0; if ((z * z) <= 5e+17) tmp = y * 0.5; elseif ((z * z) <= 1e+73) tmp = t_0; elseif ((z * z) <= 1e+196) tmp = z * (z * (-0.5 / y)); elseif ((z * z) <= 1e+218) tmp = t_0; elseif ((z * z) <= 5e+250) tmp = y * 0.5; elseif ((z * z) <= 2e+256) tmp = (x / y) * (x * 0.5); else tmp = (z / y) * (z * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 5e+17], N[(y * 0.5), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+73], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 1e+196], N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+218], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 5e+250], N[(y * 0.5), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+256], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+17}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \cdot z \leq 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 10^{+196}:\\
\;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+250}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot \left(z \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e17 or 1.00000000000000008e218 < (*.f64 z z) < 5.0000000000000002e250Initial program 70.8%
Taylor expanded in y around inf 62.1%
if 5e17 < (*.f64 z z) < 9.99999999999999983e72 or 9.9999999999999995e195 < (*.f64 z z) < 1.00000000000000008e218Initial program 94.1%
Taylor expanded in x around inf 73.8%
unpow273.8%
associate-/l*73.8%
Simplified73.8%
if 9.99999999999999983e72 < (*.f64 z z) < 9.9999999999999995e195Initial program 87.8%
div-sub66.1%
sub-neg66.1%
add-sqr-sqrt66.1%
times-frac66.1%
fma-def66.1%
hypot-def66.1%
hypot-def78.1%
times-frac78.1%
Applied egg-rr78.1%
Taylor expanded in z around inf 52.6%
*-commutative52.6%
unpow252.6%
associate-*l/52.6%
associate-*l*52.6%
Simplified52.6%
associate-*l/52.6%
associate-*r*52.6%
Applied egg-rr52.6%
div-inv52.6%
associate-*l*52.6%
*-commutative52.6%
associate-*l*52.7%
associate-*l/52.7%
metadata-eval52.7%
Applied egg-rr52.7%
if 5.0000000000000002e250 < (*.f64 z z) < 2.0000000000000001e256Initial program 77.0%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
times-frac100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if 2.0000000000000001e256 < (*.f64 z z) Initial program 51.1%
div-sub42.7%
sub-neg42.7%
add-sqr-sqrt42.7%
times-frac42.7%
fma-def48.3%
hypot-def48.3%
hypot-def61.7%
times-frac91.5%
Applied egg-rr91.5%
Taylor expanded in z around inf 61.8%
*-commutative61.8%
unpow261.8%
associate-*l/74.5%
associate-*l*74.5%
Simplified74.5%
Final simplification66.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* z (/ -0.5 y)))) (t_1 (* 0.5 (/ x (/ y x)))))
(if (<= z 4.4e-272)
(* y 0.5)
(if (<= z 4.8e-226)
t_1
(if (<= z 1e-181)
(* y 0.5)
(if (<= z 2e-155)
t_1
(if (<= z 1300000000000.0)
(* y 0.5)
(if (<= z 2.8e+36)
t_1
(if (<= z 5.6e+99)
t_0
(if (<= z 1.3e+109)
t_1
(if (<= z 5.4e+125)
(* y 0.5)
(if (<= z 1.35e+128) t_1 t_0))))))))))))
double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double t_1 = 0.5 * (x / (y / x));
double tmp;
if (z <= 4.4e-272) {
tmp = y * 0.5;
} else if (z <= 4.8e-226) {
tmp = t_1;
} else if (z <= 1e-181) {
tmp = y * 0.5;
} else if (z <= 2e-155) {
tmp = t_1;
} else if (z <= 1300000000000.0) {
tmp = y * 0.5;
} else if (z <= 2.8e+36) {
tmp = t_1;
} else if (z <= 5.6e+99) {
tmp = t_0;
} else if (z <= 1.3e+109) {
tmp = t_1;
} else if (z <= 5.4e+125) {
tmp = y * 0.5;
} else if (z <= 1.35e+128) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (z * ((-0.5d0) / y))
t_1 = 0.5d0 * (x / (y / x))
if (z <= 4.4d-272) then
tmp = y * 0.5d0
else if (z <= 4.8d-226) then
tmp = t_1
else if (z <= 1d-181) then
tmp = y * 0.5d0
else if (z <= 2d-155) then
tmp = t_1
else if (z <= 1300000000000.0d0) then
tmp = y * 0.5d0
else if (z <= 2.8d+36) then
tmp = t_1
else if (z <= 5.6d+99) then
tmp = t_0
else if (z <= 1.3d+109) then
tmp = t_1
else if (z <= 5.4d+125) then
tmp = y * 0.5d0
else if (z <= 1.35d+128) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double t_1 = 0.5 * (x / (y / x));
double tmp;
if (z <= 4.4e-272) {
tmp = y * 0.5;
} else if (z <= 4.8e-226) {
tmp = t_1;
} else if (z <= 1e-181) {
tmp = y * 0.5;
} else if (z <= 2e-155) {
tmp = t_1;
} else if (z <= 1300000000000.0) {
tmp = y * 0.5;
} else if (z <= 2.8e+36) {
tmp = t_1;
} else if (z <= 5.6e+99) {
tmp = t_0;
} else if (z <= 1.3e+109) {
tmp = t_1;
} else if (z <= 5.4e+125) {
tmp = y * 0.5;
} else if (z <= 1.35e+128) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (z * (-0.5 / y)) t_1 = 0.5 * (x / (y / x)) tmp = 0 if z <= 4.4e-272: tmp = y * 0.5 elif z <= 4.8e-226: tmp = t_1 elif z <= 1e-181: tmp = y * 0.5 elif z <= 2e-155: tmp = t_1 elif z <= 1300000000000.0: tmp = y * 0.5 elif z <= 2.8e+36: tmp = t_1 elif z <= 5.6e+99: tmp = t_0 elif z <= 1.3e+109: tmp = t_1 elif z <= 5.4e+125: tmp = y * 0.5 elif z <= 1.35e+128: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(z * Float64(-0.5 / y))) t_1 = Float64(0.5 * Float64(x / Float64(y / x))) tmp = 0.0 if (z <= 4.4e-272) tmp = Float64(y * 0.5); elseif (z <= 4.8e-226) tmp = t_1; elseif (z <= 1e-181) tmp = Float64(y * 0.5); elseif (z <= 2e-155) tmp = t_1; elseif (z <= 1300000000000.0) tmp = Float64(y * 0.5); elseif (z <= 2.8e+36) tmp = t_1; elseif (z <= 5.6e+99) tmp = t_0; elseif (z <= 1.3e+109) tmp = t_1; elseif (z <= 5.4e+125) tmp = Float64(y * 0.5); elseif (z <= 1.35e+128) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (z * (-0.5 / y)); t_1 = 0.5 * (x / (y / x)); tmp = 0.0; if (z <= 4.4e-272) tmp = y * 0.5; elseif (z <= 4.8e-226) tmp = t_1; elseif (z <= 1e-181) tmp = y * 0.5; elseif (z <= 2e-155) tmp = t_1; elseif (z <= 1300000000000.0) tmp = y * 0.5; elseif (z <= 2.8e+36) tmp = t_1; elseif (z <= 5.6e+99) tmp = t_0; elseif (z <= 1.3e+109) tmp = t_1; elseif (z <= 5.4e+125) tmp = y * 0.5; elseif (z <= 1.35e+128) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 4.4e-272], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 4.8e-226], t$95$1, If[LessEqual[z, 1e-181], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2e-155], t$95$1, If[LessEqual[z, 1300000000000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 2.8e+36], t$95$1, If[LessEqual[z, 5.6e+99], t$95$0, If[LessEqual[z, 1.3e+109], t$95$1, If[LessEqual[z, 5.4e+125], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.35e+128], t$95$1, t$95$0]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\
t_1 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \leq 4.4 \cdot 10^{-272}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 10^{-181}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1300000000000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+36}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+109}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+125}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < 4.39999999999999976e-272 or 4.7999999999999999e-226 < z < 1.00000000000000005e-181 or 2.00000000000000003e-155 < z < 1.3e12 or 1.2999999999999999e109 < z < 5.3999999999999997e125Initial program 68.8%
Taylor expanded in y around inf 45.6%
if 4.39999999999999976e-272 < z < 4.7999999999999999e-226 or 1.00000000000000005e-181 < z < 2.00000000000000003e-155 or 1.3e12 < z < 2.8000000000000001e36 or 5.6e99 < z < 1.2999999999999999e109 or 5.3999999999999997e125 < z < 1.35000000000000001e128Initial program 74.1%
Taylor expanded in x around inf 57.3%
unpow257.3%
associate-/l*62.3%
Simplified62.3%
if 2.8000000000000001e36 < z < 5.6e99 or 1.35000000000000001e128 < z Initial program 62.9%
div-sub49.4%
sub-neg49.4%
add-sqr-sqrt49.4%
times-frac49.4%
fma-def54.8%
hypot-def54.8%
hypot-def71.3%
times-frac91.8%
Applied egg-rr91.8%
Taylor expanded in z around inf 60.6%
*-commutative60.6%
unpow260.6%
associate-*l/73.0%
associate-*l*73.0%
Simplified73.0%
associate-*l/60.6%
associate-*r*60.6%
Applied egg-rr60.6%
div-inv60.6%
associate-*l*60.6%
*-commutative60.6%
associate-*l*73.0%
associate-*l/73.0%
metadata-eval73.0%
Applied egg-rr73.0%
Final simplification50.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* z (/ -0.5 y))))
(t_1 (* (/ x y) (* x 0.5)))
(t_2 (* 0.5 (/ x (/ y x)))))
(if (<= z 9.2e-272)
(* y 0.5)
(if (<= z 5.4e-226)
t_2
(if (<= z 1.6e-180)
(* y 0.5)
(if (<= z 6.5e-155)
t_1
(if (<= z 1300000000000.0)
(* y 0.5)
(if (<= z 1.9e+37)
t_2
(if (<= z 5.6e+99)
t_0
(if (<= z 1.8e+109)
t_2
(if (<= z 1.7e+126)
(* y 0.5)
(if (<= z 1.35e+128) t_1 t_0))))))))))))
double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double t_1 = (x / y) * (x * 0.5);
double t_2 = 0.5 * (x / (y / x));
double tmp;
if (z <= 9.2e-272) {
tmp = y * 0.5;
} else if (z <= 5.4e-226) {
tmp = t_2;
} else if (z <= 1.6e-180) {
tmp = y * 0.5;
} else if (z <= 6.5e-155) {
tmp = t_1;
} else if (z <= 1300000000000.0) {
tmp = y * 0.5;
} else if (z <= 1.9e+37) {
tmp = t_2;
} else if (z <= 5.6e+99) {
tmp = t_0;
} else if (z <= 1.8e+109) {
tmp = t_2;
} else if (z <= 1.7e+126) {
tmp = y * 0.5;
} else if (z <= 1.35e+128) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * (z * ((-0.5d0) / y))
t_1 = (x / y) * (x * 0.5d0)
t_2 = 0.5d0 * (x / (y / x))
if (z <= 9.2d-272) then
tmp = y * 0.5d0
else if (z <= 5.4d-226) then
tmp = t_2
else if (z <= 1.6d-180) then
tmp = y * 0.5d0
else if (z <= 6.5d-155) then
tmp = t_1
else if (z <= 1300000000000.0d0) then
tmp = y * 0.5d0
else if (z <= 1.9d+37) then
tmp = t_2
else if (z <= 5.6d+99) then
tmp = t_0
else if (z <= 1.8d+109) then
tmp = t_2
else if (z <= 1.7d+126) then
tmp = y * 0.5d0
else if (z <= 1.35d+128) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (z * (-0.5 / y));
double t_1 = (x / y) * (x * 0.5);
double t_2 = 0.5 * (x / (y / x));
double tmp;
if (z <= 9.2e-272) {
tmp = y * 0.5;
} else if (z <= 5.4e-226) {
tmp = t_2;
} else if (z <= 1.6e-180) {
tmp = y * 0.5;
} else if (z <= 6.5e-155) {
tmp = t_1;
} else if (z <= 1300000000000.0) {
tmp = y * 0.5;
} else if (z <= 1.9e+37) {
tmp = t_2;
} else if (z <= 5.6e+99) {
tmp = t_0;
} else if (z <= 1.8e+109) {
tmp = t_2;
} else if (z <= 1.7e+126) {
tmp = y * 0.5;
} else if (z <= 1.35e+128) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (z * (-0.5 / y)) t_1 = (x / y) * (x * 0.5) t_2 = 0.5 * (x / (y / x)) tmp = 0 if z <= 9.2e-272: tmp = y * 0.5 elif z <= 5.4e-226: tmp = t_2 elif z <= 1.6e-180: tmp = y * 0.5 elif z <= 6.5e-155: tmp = t_1 elif z <= 1300000000000.0: tmp = y * 0.5 elif z <= 1.9e+37: tmp = t_2 elif z <= 5.6e+99: tmp = t_0 elif z <= 1.8e+109: tmp = t_2 elif z <= 1.7e+126: tmp = y * 0.5 elif z <= 1.35e+128: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(z * Float64(-0.5 / y))) t_1 = Float64(Float64(x / y) * Float64(x * 0.5)) t_2 = Float64(0.5 * Float64(x / Float64(y / x))) tmp = 0.0 if (z <= 9.2e-272) tmp = Float64(y * 0.5); elseif (z <= 5.4e-226) tmp = t_2; elseif (z <= 1.6e-180) tmp = Float64(y * 0.5); elseif (z <= 6.5e-155) tmp = t_1; elseif (z <= 1300000000000.0) tmp = Float64(y * 0.5); elseif (z <= 1.9e+37) tmp = t_2; elseif (z <= 5.6e+99) tmp = t_0; elseif (z <= 1.8e+109) tmp = t_2; elseif (z <= 1.7e+126) tmp = Float64(y * 0.5); elseif (z <= 1.35e+128) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (z * (-0.5 / y)); t_1 = (x / y) * (x * 0.5); t_2 = 0.5 * (x / (y / x)); tmp = 0.0; if (z <= 9.2e-272) tmp = y * 0.5; elseif (z <= 5.4e-226) tmp = t_2; elseif (z <= 1.6e-180) tmp = y * 0.5; elseif (z <= 6.5e-155) tmp = t_1; elseif (z <= 1300000000000.0) tmp = y * 0.5; elseif (z <= 1.9e+37) tmp = t_2; elseif (z <= 5.6e+99) tmp = t_0; elseif (z <= 1.8e+109) tmp = t_2; elseif (z <= 1.7e+126) tmp = y * 0.5; elseif (z <= 1.35e+128) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(z * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.2e-272], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 5.4e-226], t$95$2, If[LessEqual[z, 1.6e-180], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 6.5e-155], t$95$1, If[LessEqual[z, 1300000000000.0], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.9e+37], t$95$2, If[LessEqual[z, 5.6e+99], t$95$0, If[LessEqual[z, 1.8e+109], t$95$2, If[LessEqual[z, 1.7e+126], N[(y * 0.5), $MachinePrecision], If[LessEqual[z, 1.35e+128], t$95$1, t$95$0]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \frac{-0.5}{y}\right)\\
t_1 := \frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
t_2 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \leq 9.2 \cdot 10^{-272}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-226}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-180}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1300000000000:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+37}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+109}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+126}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+128}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < 9.19999999999999955e-272 or 5.40000000000000029e-226 < z < 1.60000000000000008e-180 or 6.5e-155 < z < 1.3e12 or 1.8e109 < z < 1.69999999999999995e126Initial program 68.8%
Taylor expanded in y around inf 45.6%
if 9.19999999999999955e-272 < z < 5.40000000000000029e-226 or 1.3e12 < z < 1.89999999999999995e37 or 5.6e99 < z < 1.8e109Initial program 83.4%
Taylor expanded in x around inf 64.9%
unpow264.9%
associate-/l*64.9%
Simplified64.9%
if 1.60000000000000008e-180 < z < 6.5e-155 or 1.69999999999999995e126 < z < 1.35000000000000001e128Initial program 59.7%
Taylor expanded in x around inf 45.5%
unpow245.5%
Simplified45.5%
times-frac58.8%
div-inv58.8%
metadata-eval58.8%
Applied egg-rr58.8%
if 1.89999999999999995e37 < z < 5.6e99 or 1.35000000000000001e128 < z Initial program 62.9%
div-sub49.4%
sub-neg49.4%
add-sqr-sqrt49.4%
times-frac49.4%
fma-def54.8%
hypot-def54.8%
hypot-def71.3%
times-frac91.8%
Applied egg-rr91.8%
Taylor expanded in z around inf 60.6%
*-commutative60.6%
unpow260.6%
associate-*l/73.0%
associate-*l*73.0%
Simplified73.0%
associate-*l/60.6%
associate-*r*60.6%
Applied egg-rr60.6%
div-inv60.6%
associate-*l*60.6%
*-commutative60.6%
associate-*l*73.0%
associate-*l/73.0%
metadata-eval73.0%
Applied egg-rr73.0%
Final simplification50.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+43) (not (<= y 6.4e-223))) (* 0.5 (+ (/ x (/ y x)) (- y (/ z (/ y z))))) (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+43) || !(y <= 6.4e-223)) {
tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-7d+43)) .or. (.not. (y <= 6.4d-223))) then
tmp = 0.5d0 * ((x / (y / x)) + (y - (z / (y / z))))
else
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+43) || !(y <= 6.4e-223)) {
tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7e+43) or not (y <= 6.4e-223): tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z)))) else: tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7e+43) || !(y <= 6.4e-223)) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(y - Float64(z / Float64(y / z))))); else tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7e+43) || ~((y <= 6.4e-223))) tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z)))); else tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+43], N[Not[LessEqual[y, 6.4e-223]], $MachinePrecision]], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+43} \lor \neg \left(y \leq 6.4 \cdot 10^{-223}\right):\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\\
\end{array}
\end{array}
if y < -7.0000000000000002e43 or 6.4000000000000001e-223 < y Initial program 53.7%
Taylor expanded in x around inf 75.1%
+-commutative75.1%
distribute-lft-out75.1%
unpow275.1%
associate-/l*82.9%
unpow282.9%
associate-/l*95.7%
Simplified95.7%
if -7.0000000000000002e43 < y < 6.4000000000000001e-223Initial program 95.0%
Final simplification95.4%
(FPCore (x y z) :precision binary64 (if (<= (* x x) 5e+263) (* 0.5 (+ (/ x (/ y x)) (- y (/ z (/ y z))))) (/ 1.0 (* (/ y (- x z)) (/ 2.0 (+ x z))))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 5e+263) {
tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
} else {
tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x * x) <= 5d+263) then
tmp = 0.5d0 * ((x / (y / x)) + (y - (z / (y / z))))
else
tmp = 1.0d0 / ((y / (x - z)) * (2.0d0 / (x + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 5e+263) {
tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z))));
} else {
tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 5e+263: tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z)))) else: tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 5e+263) tmp = Float64(0.5 * Float64(Float64(x / Float64(y / x)) + Float64(y - Float64(z / Float64(y / z))))); else tmp = Float64(1.0 / Float64(Float64(y / Float64(x - z)) * Float64(2.0 / Float64(x + z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 5e+263) tmp = 0.5 * ((x / (y / x)) + (y - (z / (y / z)))); else tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+263], N[(0.5 * N[(N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision] + N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+263}:\\
\;\;\;\;0.5 \cdot \left(\frac{x}{\frac{y}{x}} + \left(y - \frac{z}{\frac{y}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000000022e263Initial program 72.1%
Taylor expanded in x around inf 88.6%
+-commutative88.6%
distribute-lft-out88.6%
unpow288.6%
associate-/l*89.3%
unpow289.3%
associate-/l*97.2%
Simplified97.2%
if 5.00000000000000022e263 < (*.f64 x x) Initial program 57.7%
Taylor expanded in y around 0 57.7%
unpow257.7%
unpow257.7%
Simplified57.7%
clear-num57.7%
inv-pow57.7%
*-commutative57.7%
*-un-lft-identity57.7%
times-frac57.7%
metadata-eval57.7%
Applied egg-rr57.7%
unpow-157.7%
associate-*r/57.7%
*-commutative57.7%
difference-of-squares77.5%
*-commutative77.5%
times-frac83.9%
+-commutative83.9%
Simplified83.9%
Final simplification93.8%
(FPCore (x y z) :precision binary64 (if (<= (* x x) 4e+131) (* 0.5 (* (- y z) (/ (+ y z) y))) (/ 1.0 (* (/ y (- x z)) (/ 2.0 (+ x z))))))
double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 4e+131) {
tmp = 0.5 * ((y - z) * ((y + z) / y));
} else {
tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x * x) <= 4d+131) then
tmp = 0.5d0 * ((y - z) * ((y + z) / y))
else
tmp = 1.0d0 / ((y / (x - z)) * (2.0d0 / (x + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x * x) <= 4e+131) {
tmp = 0.5 * ((y - z) * ((y + z) / y));
} else {
tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x * x) <= 4e+131: tmp = 0.5 * ((y - z) * ((y + z) / y)) else: tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x * x) <= 4e+131) tmp = Float64(0.5 * Float64(Float64(y - z) * Float64(Float64(y + z) / y))); else tmp = Float64(1.0 / Float64(Float64(y / Float64(x - z)) * Float64(2.0 / Float64(x + z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x * x) <= 4e+131) tmp = 0.5 * ((y - z) * ((y + z) / y)); else tmp = 1.0 / ((y / (x - z)) * (2.0 / (x + z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 4e+131], N[(0.5 * N[(N[(y - z), $MachinePrecision] * N[(N[(y + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+131}:\\
\;\;\;\;0.5 \cdot \left(\left(y - z\right) \cdot \frac{y + z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x - z} \cdot \frac{2}{x + z}}\\
\end{array}
\end{array}
if (*.f64 x x) < 3.9999999999999996e131Initial program 72.7%
Taylor expanded in x around 0 64.0%
unpow264.0%
unpow264.0%
difference-of-squares65.8%
associate-/l*90.2%
associate-/r/90.2%
Simplified90.2%
if 3.9999999999999996e131 < (*.f64 x x) Initial program 61.6%
Taylor expanded in y around 0 59.5%
unpow259.5%
unpow259.5%
Simplified59.5%
clear-num59.5%
inv-pow59.5%
*-commutative59.5%
*-un-lft-identity59.5%
times-frac59.5%
metadata-eval59.5%
Applied egg-rr59.5%
unpow-159.5%
associate-*r/59.5%
*-commutative59.5%
difference-of-squares72.5%
*-commutative72.5%
times-frac76.8%
+-commutative76.8%
Simplified76.8%
Final simplification84.9%
(FPCore (x y z)
:precision binary64
(if (<= y -3.8e-26)
(* 0.5 (- y (* z (/ z y))))
(if (<= y 8e-45)
(/ (- (* x x) (* z z)) (* y 2.0))
(* 0.5 (- y (/ z (/ y z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e-26) {
tmp = 0.5 * (y - (z * (z / y)));
} else if (y <= 8e-45) {
tmp = ((x * x) - (z * z)) / (y * 2.0);
} else {
tmp = 0.5 * (y - (z / (y / z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.8d-26)) then
tmp = 0.5d0 * (y - (z * (z / y)))
else if (y <= 8d-45) then
tmp = ((x * x) - (z * z)) / (y * 2.0d0)
else
tmp = 0.5d0 * (y - (z / (y / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e-26) {
tmp = 0.5 * (y - (z * (z / y)));
} else if (y <= 8e-45) {
tmp = ((x * x) - (z * z)) / (y * 2.0);
} else {
tmp = 0.5 * (y - (z / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e-26: tmp = 0.5 * (y - (z * (z / y))) elif y <= 8e-45: tmp = ((x * x) - (z * z)) / (y * 2.0) else: tmp = 0.5 * (y - (z / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e-26) tmp = Float64(0.5 * Float64(y - Float64(z * Float64(z / y)))); elseif (y <= 8e-45) tmp = Float64(Float64(Float64(x * x) - Float64(z * z)) / Float64(y * 2.0)); else tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e-26) tmp = 0.5 * (y - (z * (z / y))); elseif (y <= 8e-45) tmp = ((x * x) - (z * z)) / (y * 2.0); else tmp = 0.5 * (y - (z / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e-26], N[(0.5 * N[(y - N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-45], N[(N[(N[(x * x), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-26}:\\
\;\;\;\;0.5 \cdot \left(y - z \cdot \frac{z}{y}\right)\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-45}:\\
\;\;\;\;\frac{x \cdot x - z \cdot z}{y \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\end{array}
\end{array}
if y < -3.80000000000000015e-26Initial program 45.3%
div-sub45.3%
sub-neg45.3%
add-sqr-sqrt45.3%
times-frac45.3%
fma-def45.3%
hypot-def45.3%
hypot-def82.1%
times-frac98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 71.6%
distribute-lft-out--71.6%
unpow271.6%
associate-*r/83.4%
Simplified83.4%
if -3.80000000000000015e-26 < y < 7.99999999999999987e-45Initial program 91.9%
Taylor expanded in y around 0 84.6%
unpow284.6%
unpow284.6%
Simplified84.6%
if 7.99999999999999987e-45 < y Initial program 60.9%
Taylor expanded in x around inf 82.7%
+-commutative82.7%
distribute-lft-out82.7%
unpow282.7%
associate-/l*88.0%
unpow288.0%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in x around 0 74.5%
unpow274.5%
associate-/l*83.6%
Simplified83.6%
Final simplification83.9%
(FPCore (x y z) :precision binary64 (if (<= x 2.6e+163) (* 0.5 (* (- y z) (/ (+ y z) y))) (* (/ x y) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2.6e+163) {
tmp = 0.5 * ((y - z) * ((y + z) / y));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.6d+163) then
tmp = 0.5d0 * ((y - z) * ((y + z) / y))
else
tmp = (x / y) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2.6e+163) {
tmp = 0.5 * ((y - z) * ((y + z) / y));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2.6e+163: tmp = 0.5 * ((y - z) * ((y + z) / y)) else: tmp = (x / y) * (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2.6e+163) tmp = Float64(0.5 * Float64(Float64(y - z) * Float64(Float64(y + z) / y))); else tmp = Float64(Float64(x / y) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.6e+163) tmp = 0.5 * ((y - z) * ((y + z) / y)); else tmp = (x / y) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2.6e+163], N[(0.5 * N[(N[(y - z), $MachinePrecision] * N[(N[(y + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.6 \cdot 10^{+163}:\\
\;\;\;\;0.5 \cdot \left(\left(y - z\right) \cdot \frac{y + z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 2.6000000000000002e163Initial program 69.7%
Taylor expanded in x around 0 51.6%
unpow251.6%
unpow251.6%
difference-of-squares53.3%
associate-/l*75.6%
associate-/r/75.6%
Simplified75.6%
if 2.6000000000000002e163 < x Initial program 52.1%
Taylor expanded in x around inf 67.5%
unpow267.5%
Simplified67.5%
times-frac80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (<= x 4.4e+163) (* 0.5 (- y (* z (/ z y)))) (* (/ x y) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.4e+163) {
tmp = 0.5 * (y - (z * (z / y)));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.4d+163) then
tmp = 0.5d0 * (y - (z * (z / y)))
else
tmp = (x / y) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.4e+163) {
tmp = 0.5 * (y - (z * (z / y)));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.4e+163: tmp = 0.5 * (y - (z * (z / y))) else: tmp = (x / y) * (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.4e+163) tmp = Float64(0.5 * Float64(y - Float64(z * Float64(z / y)))); else tmp = Float64(Float64(x / y) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.4e+163) tmp = 0.5 * (y - (z * (z / y))); else tmp = (x / y) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.4e+163], N[(0.5 * N[(y - N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.4 \cdot 10^{+163}:\\
\;\;\;\;0.5 \cdot \left(y - z \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 4.39999999999999973e163Initial program 69.7%
div-sub63.8%
sub-neg63.8%
add-sqr-sqrt63.8%
times-frac63.9%
fma-def65.6%
hypot-def65.6%
hypot-def86.3%
times-frac94.4%
Applied egg-rr94.4%
Taylor expanded in x around 0 68.8%
distribute-lft-out--68.8%
unpow268.8%
associate-*r/75.6%
Simplified75.6%
if 4.39999999999999973e163 < x Initial program 52.1%
Taylor expanded in x around inf 67.5%
unpow267.5%
Simplified67.5%
times-frac80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (<= x 4e+163) (* 0.5 (- y (/ z (/ y z)))) (* (/ x y) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4e+163) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4d+163) then
tmp = 0.5d0 * (y - (z / (y / z)))
else
tmp = (x / y) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4e+163) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = (x / y) * (x * 0.5);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4e+163: tmp = 0.5 * (y - (z / (y / z))) else: tmp = (x / y) * (x * 0.5) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4e+163) tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); else tmp = Float64(Float64(x / y) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4e+163) tmp = 0.5 * (y - (z / (y / z))); else tmp = (x / y) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4e+163], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+163}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 3.9999999999999998e163Initial program 69.7%
Taylor expanded in x around inf 79.6%
+-commutative79.6%
distribute-lft-out79.6%
unpow279.6%
associate-/l*83.8%
unpow283.8%
associate-/l*91.8%
Simplified91.8%
Taylor expanded in x around 0 68.8%
unpow268.8%
associate-/l*75.6%
Simplified75.6%
if 3.9999999999999998e163 < x Initial program 52.1%
Taylor expanded in x around inf 67.5%
unpow267.5%
Simplified67.5%
times-frac80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (<= x 5e+68) (* y 0.5) (* 0.5 (/ x (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e+68) {
tmp = y * 0.5;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 5d+68) then
tmp = y * 0.5d0
else
tmp = 0.5d0 * (x / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5e+68) {
tmp = y * 0.5;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5e+68: tmp = y * 0.5 else: tmp = 0.5 * (x / (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5e+68) tmp = Float64(y * 0.5); else tmp = Float64(0.5 * Float64(x / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5e+68) tmp = y * 0.5; else tmp = 0.5 * (x / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5e+68], N[(y * 0.5), $MachinePrecision], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+68}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 5.0000000000000004e68Initial program 69.7%
Taylor expanded in y around inf 43.7%
if 5.0000000000000004e68 < x Initial program 62.9%
Taylor expanded in x around inf 49.2%
unpow249.2%
associate-/l*54.0%
Simplified54.0%
Final simplification45.8%
(FPCore (x y z) :precision binary64 (* y 0.5))
double code(double x, double y, double z) {
return y * 0.5;
}
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
end function
public static double code(double x, double y, double z) {
return y * 0.5;
}
def code(x, y, z): return y * 0.5
function code(x, y, z) return Float64(y * 0.5) end
function tmp = code(x, y, z) tmp = y * 0.5; end
code[x_, y_, z_] := N[(y * 0.5), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5
\end{array}
Initial program 68.4%
Taylor expanded in y around inf 40.9%
Final simplification40.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 2023293
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:herbie-target
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))