
(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 9 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}
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))))
(if (<= x 6e+88)
t_0
(if (<= x 3.5e+139)
(/ (fma y y (fma x x (* z (- z)))) (* y 2.0))
(if (<= x 8.4e+214) t_0 (* (/ x y) (/ x 2.0)))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
double tmp;
if (x <= 6e+88) {
tmp = t_0;
} else if (x <= 3.5e+139) {
tmp = fma(y, y, fma(x, x, (z * -z))) / (y * 2.0);
} else if (x <= 8.4e+214) {
tmp = t_0;
} else {
tmp = (x / y) * (x / 2.0);
}
return tmp;
}
x = abs(x) function code(x, y, z) t_0 = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))) tmp = 0.0 if (x <= 6e+88) tmp = t_0; elseif (x <= 3.5e+139) tmp = Float64(fma(y, y, fma(x, x, Float64(z * Float64(-z)))) / Float64(y * 2.0)); elseif (x <= 8.4e+214) tmp = t_0; else tmp = Float64(Float64(x / y) * Float64(x / 2.0)); end return tmp end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6e+88], t$95$0, If[LessEqual[x, 3.5e+139], N[(N[(y * y + N[(x * x + N[(z * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.4e+214], t$95$0, N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{if}\;x \leq 6 \cdot 10^{+88}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+139}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, y, \mathsf{fma}\left(x, x, z \cdot \left(-z\right)\right)\right)}{y \cdot 2}\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+214}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\
\end{array}
\end{array}
if x < 6.00000000000000011e88 or 3.49999999999999978e139 < x < 8.4000000000000003e214Initial program 72.0%
Taylor expanded in x around inf 82.8%
unpow282.8%
*-un-lft-identity82.8%
times-frac88.7%
Applied egg-rr88.7%
pow288.7%
*-un-lft-identity88.7%
times-frac95.0%
Applied egg-rr95.0%
/-rgt-identity95.0%
clear-num95.0%
un-div-inv95.0%
Applied egg-rr95.0%
if 6.00000000000000011e88 < x < 3.49999999999999978e139Initial program 86.4%
sqr-neg86.4%
sqr-neg86.4%
+-commutative86.4%
associate--l+86.4%
fma-def93.6%
fma-neg93.6%
distribute-rgt-neg-in93.6%
Simplified93.6%
if 8.4000000000000003e214 < x Initial program 63.1%
Taylor expanded in x around inf 87.0%
associate-*r/87.0%
associate-/l*87.0%
Simplified87.0%
*-un-lft-identity87.0%
unpow287.0%
times-frac95.2%
Applied egg-rr95.2%
associate-*l/95.2%
*-lft-identity95.2%
Simplified95.2%
metadata-eval95.2%
associate-*l/95.2%
associate-/l/87.0%
unpow287.0%
clear-num87.0%
metadata-eval87.0%
metadata-eval87.0%
metadata-eval87.0%
sqrt-pow287.0%
div-inv87.0%
associate-/r*87.0%
unpow287.0%
times-frac95.0%
sqrt-pow295.2%
metadata-eval95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification94.9%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (hypot y (hypot x z))))
(if (<= (* x x) 5e+246)
(+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y))))
(* t_0 (* t_0 (/ 0.5 y))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = hypot(y, hypot(x, z));
double tmp;
if ((x * x) <= 5e+246) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = t_0 * (t_0 * (0.5 / y));
}
return tmp;
}
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = Math.hypot(y, Math.hypot(x, z));
double tmp;
if ((x * x) <= 5e+246) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = t_0 * (t_0 * (0.5 / y));
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = math.hypot(y, math.hypot(x, z)) tmp = 0 if (x * x) <= 5e+246: tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))) else: tmp = t_0 * (t_0 * (0.5 / y)) return tmp
x = abs(x) function code(x, y, z) t_0 = hypot(y, hypot(x, z)) tmp = 0.0 if (Float64(x * x) <= 5e+246) tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))); else tmp = Float64(t_0 * Float64(t_0 * Float64(0.5 / y))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = hypot(y, hypot(x, z)); tmp = 0.0; if ((x * x) <= 5e+246) tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))); else tmp = t_0 * (t_0 * (0.5 / y)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Sqrt[y ^ 2 + N[Sqrt[x ^ 2 + z ^ 2], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e+246], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, \mathsf{hypot}\left(x, z\right)\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+246}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{0.5}{y}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 4.99999999999999976e246Initial program 75.7%
Taylor expanded in x around inf 89.0%
unpow289.0%
*-un-lft-identity89.0%
times-frac90.6%
Applied egg-rr90.6%
pow290.6%
*-un-lft-identity90.6%
times-frac96.6%
Applied egg-rr96.6%
/-rgt-identity96.6%
clear-num96.6%
un-div-inv96.7%
Applied egg-rr96.7%
if 4.99999999999999976e246 < (*.f64 x x) Initial program 63.5%
div-inv63.5%
add-sqr-sqrt60.9%
associate-*l*60.9%
Applied egg-rr92.1%
Final simplification95.3%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -0.5) (/ y z))))
(if (<= y -9e+101)
(* 0.5 y)
(if (<= y -5.4e-116)
(/ (* x 0.5) (/ y x))
(if (<= y -2.7e-224)
t_0
(if (<= y 4.2e-254)
(* (/ x y) (/ x 2.0))
(if (<= y 1.3e-70)
t_0
(if (<= y 3.8e-8)
(* x (* x (/ 0.5 y)))
(if (<= y 3300000000.0) t_0 (* 0.5 y))))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = (z * -0.5) / (y / z);
double tmp;
if (y <= -9e+101) {
tmp = 0.5 * y;
} else if (y <= -5.4e-116) {
tmp = (x * 0.5) / (y / x);
} else if (y <= -2.7e-224) {
tmp = t_0;
} else if (y <= 4.2e-254) {
tmp = (x / y) * (x / 2.0);
} else if (y <= 1.3e-70) {
tmp = t_0;
} else if (y <= 3.8e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= 3300000000.0) {
tmp = t_0;
} else {
tmp = 0.5 * y;
}
return tmp;
}
NOTE: x should be positive before calling this function
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 = (z * (-0.5d0)) / (y / z)
if (y <= (-9d+101)) then
tmp = 0.5d0 * y
else if (y <= (-5.4d-116)) then
tmp = (x * 0.5d0) / (y / x)
else if (y <= (-2.7d-224)) then
tmp = t_0
else if (y <= 4.2d-254) then
tmp = (x / y) * (x / 2.0d0)
else if (y <= 1.3d-70) then
tmp = t_0
else if (y <= 3.8d-8) then
tmp = x * (x * (0.5d0 / y))
else if (y <= 3300000000.0d0) then
tmp = t_0
else
tmp = 0.5d0 * y
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = (z * -0.5) / (y / z);
double tmp;
if (y <= -9e+101) {
tmp = 0.5 * y;
} else if (y <= -5.4e-116) {
tmp = (x * 0.5) / (y / x);
} else if (y <= -2.7e-224) {
tmp = t_0;
} else if (y <= 4.2e-254) {
tmp = (x / y) * (x / 2.0);
} else if (y <= 1.3e-70) {
tmp = t_0;
} else if (y <= 3.8e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= 3300000000.0) {
tmp = t_0;
} else {
tmp = 0.5 * y;
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = (z * -0.5) / (y / z) tmp = 0 if y <= -9e+101: tmp = 0.5 * y elif y <= -5.4e-116: tmp = (x * 0.5) / (y / x) elif y <= -2.7e-224: tmp = t_0 elif y <= 4.2e-254: tmp = (x / y) * (x / 2.0) elif y <= 1.3e-70: tmp = t_0 elif y <= 3.8e-8: tmp = x * (x * (0.5 / y)) elif y <= 3300000000.0: tmp = t_0 else: tmp = 0.5 * y return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(Float64(z * -0.5) / Float64(y / z)) tmp = 0.0 if (y <= -9e+101) tmp = Float64(0.5 * y); elseif (y <= -5.4e-116) tmp = Float64(Float64(x * 0.5) / Float64(y / x)); elseif (y <= -2.7e-224) tmp = t_0; elseif (y <= 4.2e-254) tmp = Float64(Float64(x / y) * Float64(x / 2.0)); elseif (y <= 1.3e-70) tmp = t_0; elseif (y <= 3.8e-8) tmp = Float64(x * Float64(x * Float64(0.5 / y))); elseif (y <= 3300000000.0) tmp = t_0; else tmp = Float64(0.5 * y); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = (z * -0.5) / (y / z); tmp = 0.0; if (y <= -9e+101) tmp = 0.5 * y; elseif (y <= -5.4e-116) tmp = (x * 0.5) / (y / x); elseif (y <= -2.7e-224) tmp = t_0; elseif (y <= 4.2e-254) tmp = (x / y) * (x / 2.0); elseif (y <= 1.3e-70) tmp = t_0; elseif (y <= 3.8e-8) tmp = x * (x * (0.5 / y)); elseif (y <= 3300000000.0) tmp = t_0; else tmp = 0.5 * y; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+101], N[(0.5 * y), $MachinePrecision], If[LessEqual[y, -5.4e-116], N[(N[(x * 0.5), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.7e-224], t$95$0, If[LessEqual[y, 4.2e-254], N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-70], t$95$0, If[LessEqual[y, 3.8e-8], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3300000000.0], t$95$0, N[(0.5 * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+101}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-116}:\\
\;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-224}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-254}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-70}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{elif}\;y \leq 3300000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -9.0000000000000004e101 or 3.3e9 < y Initial program 35.0%
Taylor expanded in y around inf 70.2%
if -9.0000000000000004e101 < y < -5.4e-116Initial program 93.3%
Taylor expanded in x around inf 57.8%
associate-*r/57.8%
associate-/l*57.8%
Simplified57.8%
*-un-lft-identity57.8%
unpow257.8%
times-frac57.8%
Applied egg-rr57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
associate-/l/57.8%
unpow257.8%
associate-/r/57.8%
metadata-eval57.8%
metadata-eval57.8%
metadata-eval57.8%
sqrt-pow257.5%
associate-/r*57.5%
*-commutative57.5%
*-commutative57.5%
unpow257.5%
associate-*l*57.6%
*-commutative57.6%
associate-/r*57.6%
sqrt-pow257.9%
metadata-eval57.9%
metadata-eval57.9%
metadata-eval57.9%
Applied egg-rr57.9%
*-commutative57.9%
*-commutative57.9%
associate-*l/57.8%
associate-*l/57.8%
associate-*r/57.8%
clear-num57.8%
un-div-inv57.9%
Applied egg-rr57.9%
if -5.4e-116 < y < -2.69999999999999998e-224 or 4.19999999999999993e-254 < y < 1.30000000000000001e-70 or 3.80000000000000028e-8 < y < 3.3e9Initial program 91.2%
Taylor expanded in z around inf 59.5%
*-commutative59.5%
Simplified59.5%
pow288.4%
*-un-lft-identity88.4%
times-frac88.4%
Applied egg-rr59.5%
associate-/r/59.5%
clear-num59.5%
associate-*l/59.5%
Applied egg-rr59.5%
if -2.69999999999999998e-224 < y < 4.19999999999999993e-254Initial program 87.7%
Taylor expanded in x around inf 75.0%
associate-*r/77.4%
associate-/l*77.3%
Simplified77.3%
*-un-lft-identity77.3%
unpow277.3%
times-frac80.1%
Applied egg-rr80.1%
associate-*l/80.2%
*-lft-identity80.2%
Simplified80.2%
metadata-eval80.2%
associate-*l/77.8%
associate-/l/74.9%
unpow274.9%
clear-num75.0%
metadata-eval75.0%
metadata-eval75.0%
metadata-eval75.0%
sqrt-pow274.7%
div-inv74.7%
associate-/r*77.1%
unpow277.1%
times-frac80.0%
sqrt-pow280.3%
metadata-eval80.3%
metadata-eval80.3%
Applied egg-rr80.3%
if 1.30000000000000001e-70 < y < 3.80000000000000028e-8Initial program 91.4%
Taylor expanded in x around inf 51.9%
associate-*r/51.9%
associate-/l*52.2%
Simplified52.2%
*-un-lft-identity52.2%
unpow252.2%
times-frac52.0%
Applied egg-rr52.0%
associate-*l/52.0%
*-lft-identity52.0%
Simplified52.0%
associate-/l/52.2%
unpow252.2%
associate-/r/51.9%
metadata-eval51.9%
metadata-eval51.9%
metadata-eval51.9%
sqrt-pow251.6%
associate-/r*51.6%
*-commutative51.6%
*-commutative51.6%
unpow251.6%
associate-*l*51.6%
*-commutative51.6%
associate-/r*51.6%
sqrt-pow252.2%
metadata-eval52.2%
metadata-eval52.2%
metadata-eval52.2%
Applied egg-rr52.2%
Final simplification65.1%
NOTE: x should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -0.5) (/ y z))))
(if (<= y -8.6e+101)
(* 0.5 y)
(if (<= y -1.7e-114)
(/ (* x 0.5) (/ y x))
(if (<= y -5.4e-226)
t_0
(if (<= y 4e-255)
(* (/ x y) (/ x 2.0))
(if (<= y 1.06e-67)
t_0
(if (<= y 5.5e-8)
(* x (* x (/ 0.5 y)))
(if (<= y 30000000000.0)
(* -0.5 (* z (/ z y)))
(* 0.5 y))))))))))x = abs(x);
double code(double x, double y, double z) {
double t_0 = (z * -0.5) / (y / z);
double tmp;
if (y <= -8.6e+101) {
tmp = 0.5 * y;
} else if (y <= -1.7e-114) {
tmp = (x * 0.5) / (y / x);
} else if (y <= -5.4e-226) {
tmp = t_0;
} else if (y <= 4e-255) {
tmp = (x / y) * (x / 2.0);
} else if (y <= 1.06e-67) {
tmp = t_0;
} else if (y <= 5.5e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= 30000000000.0) {
tmp = -0.5 * (z * (z / y));
} else {
tmp = 0.5 * y;
}
return tmp;
}
NOTE: x should be positive before calling this function
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 = (z * (-0.5d0)) / (y / z)
if (y <= (-8.6d+101)) then
tmp = 0.5d0 * y
else if (y <= (-1.7d-114)) then
tmp = (x * 0.5d0) / (y / x)
else if (y <= (-5.4d-226)) then
tmp = t_0
else if (y <= 4d-255) then
tmp = (x / y) * (x / 2.0d0)
else if (y <= 1.06d-67) then
tmp = t_0
else if (y <= 5.5d-8) then
tmp = x * (x * (0.5d0 / y))
else if (y <= 30000000000.0d0) then
tmp = (-0.5d0) * (z * (z / y))
else
tmp = 0.5d0 * y
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double t_0 = (z * -0.5) / (y / z);
double tmp;
if (y <= -8.6e+101) {
tmp = 0.5 * y;
} else if (y <= -1.7e-114) {
tmp = (x * 0.5) / (y / x);
} else if (y <= -5.4e-226) {
tmp = t_0;
} else if (y <= 4e-255) {
tmp = (x / y) * (x / 2.0);
} else if (y <= 1.06e-67) {
tmp = t_0;
} else if (y <= 5.5e-8) {
tmp = x * (x * (0.5 / y));
} else if (y <= 30000000000.0) {
tmp = -0.5 * (z * (z / y));
} else {
tmp = 0.5 * y;
}
return tmp;
}
x = abs(x) def code(x, y, z): t_0 = (z * -0.5) / (y / z) tmp = 0 if y <= -8.6e+101: tmp = 0.5 * y elif y <= -1.7e-114: tmp = (x * 0.5) / (y / x) elif y <= -5.4e-226: tmp = t_0 elif y <= 4e-255: tmp = (x / y) * (x / 2.0) elif y <= 1.06e-67: tmp = t_0 elif y <= 5.5e-8: tmp = x * (x * (0.5 / y)) elif y <= 30000000000.0: tmp = -0.5 * (z * (z / y)) else: tmp = 0.5 * y return tmp
x = abs(x) function code(x, y, z) t_0 = Float64(Float64(z * -0.5) / Float64(y / z)) tmp = 0.0 if (y <= -8.6e+101) tmp = Float64(0.5 * y); elseif (y <= -1.7e-114) tmp = Float64(Float64(x * 0.5) / Float64(y / x)); elseif (y <= -5.4e-226) tmp = t_0; elseif (y <= 4e-255) tmp = Float64(Float64(x / y) * Float64(x / 2.0)); elseif (y <= 1.06e-67) tmp = t_0; elseif (y <= 5.5e-8) tmp = Float64(x * Float64(x * Float64(0.5 / y))); elseif (y <= 30000000000.0) tmp = Float64(-0.5 * Float64(z * Float64(z / y))); else tmp = Float64(0.5 * y); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) t_0 = (z * -0.5) / (y / z); tmp = 0.0; if (y <= -8.6e+101) tmp = 0.5 * y; elseif (y <= -1.7e-114) tmp = (x * 0.5) / (y / x); elseif (y <= -5.4e-226) tmp = t_0; elseif (y <= 4e-255) tmp = (x / y) * (x / 2.0); elseif (y <= 1.06e-67) tmp = t_0; elseif (y <= 5.5e-8) tmp = x * (x * (0.5 / y)); elseif (y <= 30000000000.0) tmp = -0.5 * (z * (z / y)); else tmp = 0.5 * y; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -0.5), $MachinePrecision] / N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.6e+101], N[(0.5 * y), $MachinePrecision], If[LessEqual[y, -1.7e-114], N[(N[(x * 0.5), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.4e-226], t$95$0, If[LessEqual[y, 4e-255], N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e-67], t$95$0, If[LessEqual[y, 5.5e-8], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 30000000000.0], N[(-0.5 * N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
t_0 := \frac{z \cdot -0.5}{\frac{y}{z}}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+101}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{-114}:\\
\;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-226}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-255}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\mathbf{elif}\;y \leq 30000000000:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if y < -8.6000000000000002e101 or 3e10 < y Initial program 35.0%
Taylor expanded in y around inf 70.2%
if -8.6000000000000002e101 < y < -1.69999999999999991e-114Initial program 93.3%
Taylor expanded in x around inf 57.8%
associate-*r/57.8%
associate-/l*57.8%
Simplified57.8%
*-un-lft-identity57.8%
unpow257.8%
times-frac57.8%
Applied egg-rr57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
associate-/l/57.8%
unpow257.8%
associate-/r/57.8%
metadata-eval57.8%
metadata-eval57.8%
metadata-eval57.8%
sqrt-pow257.5%
associate-/r*57.5%
*-commutative57.5%
*-commutative57.5%
unpow257.5%
associate-*l*57.6%
*-commutative57.6%
associate-/r*57.6%
sqrt-pow257.9%
metadata-eval57.9%
metadata-eval57.9%
metadata-eval57.9%
Applied egg-rr57.9%
*-commutative57.9%
*-commutative57.9%
associate-*l/57.8%
associate-*l/57.8%
associate-*r/57.8%
clear-num57.8%
un-div-inv57.9%
Applied egg-rr57.9%
if -1.69999999999999991e-114 < y < -5.40000000000000029e-226 or 4e-255 < y < 1.06e-67Initial program 90.7%
Taylor expanded in z around inf 58.6%
*-commutative58.6%
Simplified58.6%
pow287.7%
*-un-lft-identity87.7%
times-frac87.8%
Applied egg-rr58.6%
associate-/r/58.7%
clear-num58.7%
associate-*l/58.7%
Applied egg-rr58.7%
if -5.40000000000000029e-226 < y < 4e-255Initial program 87.7%
Taylor expanded in x around inf 75.0%
associate-*r/77.4%
associate-/l*77.3%
Simplified77.3%
*-un-lft-identity77.3%
unpow277.3%
times-frac80.1%
Applied egg-rr80.1%
associate-*l/80.2%
*-lft-identity80.2%
Simplified80.2%
metadata-eval80.2%
associate-*l/77.8%
associate-/l/74.9%
unpow274.9%
clear-num75.0%
metadata-eval75.0%
metadata-eval75.0%
metadata-eval75.0%
sqrt-pow274.7%
div-inv74.7%
associate-/r*77.1%
unpow277.1%
times-frac80.0%
sqrt-pow280.3%
metadata-eval80.3%
metadata-eval80.3%
Applied egg-rr80.3%
if 1.06e-67 < y < 5.5000000000000003e-8Initial program 91.4%
Taylor expanded in x around inf 51.9%
associate-*r/51.9%
associate-/l*52.2%
Simplified52.2%
*-un-lft-identity52.2%
unpow252.2%
times-frac52.0%
Applied egg-rr52.0%
associate-*l/52.0%
*-lft-identity52.0%
Simplified52.0%
associate-/l/52.2%
unpow252.2%
associate-/r/51.9%
metadata-eval51.9%
metadata-eval51.9%
metadata-eval51.9%
sqrt-pow251.6%
associate-/r*51.6%
*-commutative51.6%
*-commutative51.6%
unpow251.6%
associate-*l*51.6%
*-commutative51.6%
associate-/r*51.6%
sqrt-pow252.2%
metadata-eval52.2%
metadata-eval52.2%
metadata-eval52.2%
Applied egg-rr52.2%
if 5.5000000000000003e-8 < y < 3e10Initial program 100.0%
Taylor expanded in z around inf 75.3%
*-commutative75.3%
Simplified75.3%
pow2100.0%
*-un-lft-identity100.0%
times-frac100.0%
Applied egg-rr75.3%
Final simplification65.1%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -1.3e+149) (not (<= y 1.35e+154))) (* 0.5 y) (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e+149) || !(y <= 1.35e+154)) {
tmp = 0.5 * y;
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
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 <= (-1.3d+149)) .or. (.not. (y <= 1.35d+154))) then
tmp = 0.5d0 * y
else
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e+149) || !(y <= 1.35e+154)) {
tmp = 0.5 * y;
} else {
tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if (y <= -1.3e+149) or not (y <= 1.35e+154): tmp = 0.5 * y else: tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if ((y <= -1.3e+149) || !(y <= 1.35e+154)) tmp = Float64(0.5 * y); else tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.3e+149) || ~((y <= 1.35e+154))) tmp = 0.5 * y; else tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -1.3e+149], N[Not[LessEqual[y, 1.35e+154]], $MachinePrecision]], N[(0.5 * y), $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}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+149} \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}\\
\end{array}
\end{array}
if y < -1.29999999999999989e149 or 1.35000000000000003e154 < y Initial program 10.9%
Taylor expanded in y around inf 78.9%
if -1.29999999999999989e149 < y < 1.35000000000000003e154Initial program 90.4%
Final simplification87.7%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 6.5e+214) (+ (* 0.5 (- y (/ z (/ y z)))) (* 0.5 (* x (/ x y)))) (* (/ x y) (/ x 2.0))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+214) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = (x / y) * (x / 2.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
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 <= 6.5d+214) then
tmp = (0.5d0 * (y - (z / (y / z)))) + (0.5d0 * (x * (x / y)))
else
tmp = (x / y) * (x / 2.0d0)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 6.5e+214) {
tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y)));
} else {
tmp = (x / y) * (x / 2.0);
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if x <= 6.5e+214: tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))) else: tmp = (x / y) * (x / 2.0) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if (x <= 6.5e+214) tmp = Float64(Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))) + Float64(0.5 * Float64(x * Float64(x / y)))); else tmp = Float64(Float64(x / y) * Float64(x / 2.0)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 6.5e+214) tmp = (0.5 * (y - (z / (y / z)))) + (0.5 * (x * (x / y))); else tmp = (x / y) * (x / 2.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 6.5e+214], N[(N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+214}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right) + 0.5 \cdot \left(x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{2}\\
\end{array}
\end{array}
if x < 6.5000000000000001e214Initial program 72.9%
Taylor expanded in x around inf 82.6%
unpow282.6%
*-un-lft-identity82.6%
times-frac88.1%
Applied egg-rr88.1%
pow288.1%
*-un-lft-identity88.1%
times-frac94.0%
Applied egg-rr94.0%
/-rgt-identity94.0%
clear-num94.0%
un-div-inv94.0%
Applied egg-rr94.0%
if 6.5000000000000001e214 < x Initial program 63.1%
Taylor expanded in x around inf 87.0%
associate-*r/87.0%
associate-/l*87.0%
Simplified87.0%
*-un-lft-identity87.0%
unpow287.0%
times-frac95.2%
Applied egg-rr95.2%
associate-*l/95.2%
*-lft-identity95.2%
Simplified95.2%
metadata-eval95.2%
associate-*l/95.2%
associate-/l/87.0%
unpow287.0%
clear-num87.0%
metadata-eval87.0%
metadata-eval87.0%
metadata-eval87.0%
sqrt-pow287.0%
div-inv87.0%
associate-/r*87.0%
unpow287.0%
times-frac95.0%
sqrt-pow295.2%
metadata-eval95.2%
metadata-eval95.2%
Applied egg-rr95.2%
Final simplification94.1%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+101) (not (<= y 2150000000000.0))) (* 0.5 y) (* x (* x (/ 0.5 y)))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+101) || !(y <= 2150000000000.0)) {
tmp = 0.5 * y;
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
NOTE: x should be positive before calling this function
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 <= (-1.05d+101)) .or. (.not. (y <= 2150000000000.0d0))) then
tmp = 0.5d0 * y
else
tmp = x * (x * (0.5d0 / y))
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+101) || !(y <= 2150000000000.0)) {
tmp = 0.5 * y;
} else {
tmp = x * (x * (0.5 / y));
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if (y <= -1.05e+101) or not (y <= 2150000000000.0): tmp = 0.5 * y else: tmp = x * (x * (0.5 / y)) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+101) || !(y <= 2150000000000.0)) tmp = Float64(0.5 * y); else tmp = Float64(x * Float64(x * Float64(0.5 / y))); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+101) || ~((y <= 2150000000000.0))) tmp = 0.5 * y; else tmp = x * (x * (0.5 / y)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+101], N[Not[LessEqual[y, 2150000000000.0]], $MachinePrecision]], N[(0.5 * y), $MachinePrecision], N[(x * N[(x * N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+101} \lor \neg \left(y \leq 2150000000000\right):\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y}\right)\\
\end{array}
\end{array}
if y < -1.05e101 or 2.15e12 < y Initial program 35.8%
Taylor expanded in y around inf 70.5%
if -1.05e101 < y < 2.15e12Initial program 91.1%
Taylor expanded in x around inf 49.2%
associate-*r/49.6%
associate-/l*49.6%
Simplified49.6%
*-un-lft-identity49.6%
unpow249.6%
times-frac51.3%
Applied egg-rr51.3%
associate-*l/51.3%
*-lft-identity51.3%
Simplified51.3%
associate-/l/49.6%
unpow249.6%
associate-/r/49.6%
metadata-eval49.6%
metadata-eval49.6%
metadata-eval49.6%
sqrt-pow249.4%
associate-/r*49.4%
*-commutative49.4%
*-commutative49.4%
unpow249.4%
associate-*l*51.0%
*-commutative51.0%
associate-/r*51.0%
sqrt-pow251.3%
metadata-eval51.3%
metadata-eval51.3%
metadata-eval51.3%
Applied egg-rr51.3%
Final simplification57.9%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= y -8.2e+101) (not (<= y 1700000000000.0))) (* 0.5 y) (/ (* x 0.5) (/ y x))))
x = abs(x);
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e+101) || !(y <= 1700000000000.0)) {
tmp = 0.5 * y;
} else {
tmp = (x * 0.5) / (y / x);
}
return tmp;
}
NOTE: x should be positive before calling this function
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 <= (-8.2d+101)) .or. (.not. (y <= 1700000000000.0d0))) then
tmp = 0.5d0 * y
else
tmp = (x * 0.5d0) / (y / x)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8.2e+101) || !(y <= 1700000000000.0)) {
tmp = 0.5 * y;
} else {
tmp = (x * 0.5) / (y / x);
}
return tmp;
}
x = abs(x) def code(x, y, z): tmp = 0 if (y <= -8.2e+101) or not (y <= 1700000000000.0): tmp = 0.5 * y else: tmp = (x * 0.5) / (y / x) return tmp
x = abs(x) function code(x, y, z) tmp = 0.0 if ((y <= -8.2e+101) || !(y <= 1700000000000.0)) tmp = Float64(0.5 * y); else tmp = Float64(Float64(x * 0.5) / Float64(y / x)); end return tmp end
x = abs(x) function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8.2e+101) || ~((y <= 1700000000000.0))) tmp = 0.5 * y; else tmp = (x * 0.5) / (y / x); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[y, -8.2e+101], N[Not[LessEqual[y, 1700000000000.0]], $MachinePrecision]], N[(0.5 * y), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+101} \lor \neg \left(y \leq 1700000000000\right):\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 0.5}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < -8.1999999999999999e101 or 1.7e12 < y Initial program 34.3%
Taylor expanded in y around inf 70.9%
if -8.1999999999999999e101 < y < 1.7e12Initial program 91.2%
Taylor expanded in x around inf 49.2%
associate-*r/49.7%
associate-/l*49.6%
Simplified49.6%
*-un-lft-identity49.6%
unpow249.6%
times-frac51.3%
Applied egg-rr51.3%
associate-*l/51.3%
*-lft-identity51.3%
Simplified51.3%
associate-/l/49.6%
unpow249.6%
associate-/r/49.6%
metadata-eval49.6%
metadata-eval49.6%
metadata-eval49.6%
sqrt-pow249.4%
associate-/r*49.4%
*-commutative49.4%
*-commutative49.4%
unpow249.4%
associate-*l*51.0%
*-commutative51.0%
associate-/r*51.0%
sqrt-pow251.3%
metadata-eval51.3%
metadata-eval51.3%
metadata-eval51.3%
Applied egg-rr51.3%
*-commutative51.3%
*-commutative51.3%
associate-*l/51.3%
associate-*l/49.7%
associate-*r/51.3%
clear-num51.3%
un-div-inv51.3%
Applied egg-rr51.3%
Final simplification57.9%
NOTE: x should be positive before calling this function (FPCore (x y z) :precision binary64 (* 0.5 y))
x = abs(x);
double code(double x, double y, double z) {
return 0.5 * y;
}
NOTE: x should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * y
end function
x = Math.abs(x);
public static double code(double x, double y, double z) {
return 0.5 * y;
}
x = abs(x) def code(x, y, z): return 0.5 * y
x = abs(x) function code(x, y, z) return Float64(0.5 * y) end
x = abs(x) function tmp = code(x, y, z) tmp = 0.5 * y; end
NOTE: x should be positive before calling this function code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
x = |x|\\
\\
0.5 \cdot y
\end{array}
Initial program 72.1%
Taylor expanded in y around inf 33.1%
Final simplification33.1%
(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 2023310
(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)))