
(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 11 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 (* 0.5 (+ y (/ (+ z x) (/ y (- x z))))))
double code(double x, double y, double z) {
return 0.5 * (y + ((z + x) / (y / (x - z))));
}
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 + ((z + x) / (y / (x - z))))
end function
public static double code(double x, double y, double z) {
return 0.5 * (y + ((z + x) / (y / (x - z))));
}
def code(x, y, z): return 0.5 * (y + ((z + x) / (y / (x - z))))
function code(x, y, z) return Float64(0.5 * Float64(y + Float64(Float64(z + x) / Float64(y / Float64(x - z))))) end
function tmp = code(x, y, z) tmp = 0.5 * (y + ((z + x) / (y / (x - z)))); end
code[x_, y_, z_] := N[(0.5 * N[(y + N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(y + \frac{z + x}{\frac{y}{x - z}}\right)
\end{array}
Initial program 71.8%
Taylor expanded in y around 0 85.2%
distribute-lft-out85.2%
+-lft-identity85.2%
mul0-lft85.2%
metadata-eval85.2%
distribute-lft1-in85.2%
unpow285.2%
unpow285.2%
sub-neg85.2%
mul-1-neg85.2%
unpow285.2%
+-commutative85.2%
unpow285.2%
distribute-lft1-in85.2%
metadata-eval85.2%
mul0-lft85.2%
+-lft-identity85.2%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 0.5 (/ x (/ y x)))))
(if (<= (* z z) 4e-62)
t_0
(if (<= (* z z) 4e-35)
(* 0.5 y)
(if (<= (* z z) 2e+30)
t_0
(if (<= (* z z) 2e+113)
(* (* z z) (/ -0.5 y))
(if (<= (* z z) 5e+190) (* 0.5 y) (* z (/ z (/ y -0.5))))))))))
double code(double x, double y, double z) {
double t_0 = 0.5 * (x / (y / x));
double tmp;
if ((z * z) <= 4e-62) {
tmp = t_0;
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = t_0;
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z * (z / (y / -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) <= 4d-62) then
tmp = t_0
else if ((z * z) <= 4d-35) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+30) then
tmp = t_0
else if ((z * z) <= 2d+113) then
tmp = (z * z) * ((-0.5d0) / y)
else if ((z * z) <= 5d+190) then
tmp = 0.5d0 * y
else
tmp = z * (z / (y / (-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) <= 4e-62) {
tmp = t_0;
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = t_0;
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z * (z / (y / -0.5));
}
return tmp;
}
def code(x, y, z): t_0 = 0.5 * (x / (y / x)) tmp = 0 if (z * z) <= 4e-62: tmp = t_0 elif (z * z) <= 4e-35: tmp = 0.5 * y elif (z * z) <= 2e+30: tmp = t_0 elif (z * z) <= 2e+113: tmp = (z * z) * (-0.5 / y) elif (z * z) <= 5e+190: tmp = 0.5 * y else: tmp = z * (z / (y / -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) <= 4e-62) tmp = t_0; elseif (Float64(z * z) <= 4e-35) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+30) tmp = t_0; elseif (Float64(z * z) <= 2e+113) tmp = Float64(Float64(z * z) * Float64(-0.5 / y)); elseif (Float64(z * z) <= 5e+190) tmp = Float64(0.5 * y); else tmp = Float64(z * Float64(z / Float64(y / -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) <= 4e-62) tmp = t_0; elseif ((z * z) <= 4e-35) tmp = 0.5 * y; elseif ((z * z) <= 2e+30) tmp = t_0; elseif ((z * z) <= 2e+113) tmp = (z * z) * (-0.5 / y); elseif ((z * z) <= 5e+190) tmp = 0.5 * y; else tmp = z * (z / (y / -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], 4e-62], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 4e-35], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], t$95$0, If[LessEqual[N[(z * z), $MachinePrecision], 2e+113], N[(N[(z * z), $MachinePrecision] * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(0.5 * y), $MachinePrecision], N[(z * N[(z / N[(y / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \frac{-0.5}{y}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{z}{\frac{y}{-0.5}}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.0000000000000002e-62 or 4.00000000000000003e-35 < (*.f64 z z) < 2e30Initial program 77.6%
Taylor expanded in x around inf 54.7%
unpow254.7%
associate-/l*60.3%
Simplified60.3%
if 4.0000000000000002e-62 < (*.f64 z z) < 4.00000000000000003e-35 or 2e113 < (*.f64 z z) < 5.00000000000000036e190Initial program 78.8%
Taylor expanded in y around inf 59.7%
if 2e30 < (*.f64 z z) < 2e113Initial program 89.0%
Taylor expanded in z around inf 66.5%
unpow266.5%
associate-*r/66.5%
associate-*r*66.5%
metadata-eval66.5%
associate-*r*66.5%
neg-mul-166.5%
*-commutative66.5%
neg-mul-166.5%
*-commutative66.5%
associate-*l*66.5%
metadata-eval66.5%
Simplified66.5%
frac-2neg66.5%
div-inv66.7%
distribute-rgt-neg-in66.7%
Applied egg-rr66.7%
associate-*r/66.5%
*-rgt-identity66.5%
distribute-rgt-neg-out66.5%
*-commutative66.5%
distribute-neg-frac66.5%
associate-/l*66.5%
distribute-neg-frac66.5%
neg-mul-166.5%
*-commutative66.5%
times-frac66.5%
metadata-eval66.5%
Simplified66.5%
*-un-lft-identity66.5%
*-commutative66.5%
times-frac66.5%
clear-num66.3%
frac-2neg66.3%
remove-double-neg66.3%
times-frac66.5%
metadata-eval66.5%
metadata-eval66.5%
div-inv66.5%
div-inv66.7%
clear-num66.7%
Applied egg-rr66.7%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 61.7%
Taylor expanded in z around inf 66.9%
unpow266.9%
associate-*r/66.9%
associate-*r*66.9%
metadata-eval66.9%
associate-*r*66.9%
neg-mul-166.9%
*-commutative66.9%
neg-mul-166.9%
*-commutative66.9%
associate-*l*66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in z around 0 66.9%
metadata-eval66.9%
times-frac66.9%
*-lft-identity66.9%
unpow266.9%
times-frac70.9%
metadata-eval70.9%
associate-/l*70.9%
/-rgt-identity70.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/70.9%
associate-/l*70.9%
Simplified70.9%
Final simplification64.7%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 4e-62)
(* (/ x y) (* 0.5 x))
(if (<= (* z z) 4e-35)
(* 0.5 y)
(if (<= (* z z) 2e+30)
(* 0.5 (/ x (/ y x)))
(if (<= (* z z) 2e+113)
(* (* z z) (/ -0.5 y))
(if (<= (* z z) 5e+190) (* 0.5 y) (* z (/ z (/ y -0.5)))))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z * (z / (y / -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 ((z * z) <= 4d-62) then
tmp = (x / y) * (0.5d0 * x)
else if ((z * z) <= 4d-35) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+30) then
tmp = 0.5d0 * (x / (y / x))
else if ((z * z) <= 2d+113) then
tmp = (z * z) * ((-0.5d0) / y)
else if ((z * z) <= 5d+190) then
tmp = 0.5d0 * y
else
tmp = z * (z / (y / (-0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z * (z / (y / -0.5));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4e-62: tmp = (x / y) * (0.5 * x) elif (z * z) <= 4e-35: tmp = 0.5 * y elif (z * z) <= 2e+30: tmp = 0.5 * (x / (y / x)) elif (z * z) <= 2e+113: tmp = (z * z) * (-0.5 / y) elif (z * z) <= 5e+190: tmp = 0.5 * y else: tmp = z * (z / (y / -0.5)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e-62) tmp = Float64(Float64(x / y) * Float64(0.5 * x)); elseif (Float64(z * z) <= 4e-35) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+30) tmp = Float64(0.5 * Float64(x / Float64(y / x))); elseif (Float64(z * z) <= 2e+113) tmp = Float64(Float64(z * z) * Float64(-0.5 / y)); elseif (Float64(z * z) <= 5e+190) tmp = Float64(0.5 * y); else tmp = Float64(z * Float64(z / Float64(y / -0.5))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e-62) tmp = (x / y) * (0.5 * x); elseif ((z * z) <= 4e-35) tmp = 0.5 * y; elseif ((z * z) <= 2e+30) tmp = 0.5 * (x / (y / x)); elseif ((z * z) <= 2e+113) tmp = (z * z) * (-0.5 / y); elseif ((z * z) <= 5e+190) tmp = 0.5 * y; else tmp = z * (z / (y / -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e-62], N[(N[(x / y), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e-35], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+113], N[(N[(z * z), $MachinePrecision] * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(0.5 * y), $MachinePrecision], N[(z * N[(z / N[(y / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \frac{-0.5}{y}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{z}{\frac{y}{-0.5}}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.0000000000000002e-62Initial program 77.4%
Taylor expanded in x around inf 55.4%
unpow255.4%
Simplified55.4%
Taylor expanded in x around 0 55.4%
*-commutative55.4%
unpow255.4%
associate-*l/60.1%
associate-*r*60.1%
Simplified60.1%
if 4.0000000000000002e-62 < (*.f64 z z) < 4.00000000000000003e-35 or 2e113 < (*.f64 z z) < 5.00000000000000036e190Initial program 78.8%
Taylor expanded in y around inf 59.7%
if 4.00000000000000003e-35 < (*.f64 z z) < 2e30Initial program 78.9%
Taylor expanded in x around inf 48.7%
unpow248.7%
associate-/l*62.6%
Simplified62.6%
if 2e30 < (*.f64 z z) < 2e113Initial program 89.0%
Taylor expanded in z around inf 66.5%
unpow266.5%
associate-*r/66.5%
associate-*r*66.5%
metadata-eval66.5%
associate-*r*66.5%
neg-mul-166.5%
*-commutative66.5%
neg-mul-166.5%
*-commutative66.5%
associate-*l*66.5%
metadata-eval66.5%
Simplified66.5%
frac-2neg66.5%
div-inv66.7%
distribute-rgt-neg-in66.7%
Applied egg-rr66.7%
associate-*r/66.5%
*-rgt-identity66.5%
distribute-rgt-neg-out66.5%
*-commutative66.5%
distribute-neg-frac66.5%
associate-/l*66.5%
distribute-neg-frac66.5%
neg-mul-166.5%
*-commutative66.5%
times-frac66.5%
metadata-eval66.5%
Simplified66.5%
*-un-lft-identity66.5%
*-commutative66.5%
times-frac66.5%
clear-num66.3%
frac-2neg66.3%
remove-double-neg66.3%
times-frac66.5%
metadata-eval66.5%
metadata-eval66.5%
div-inv66.5%
div-inv66.7%
clear-num66.7%
Applied egg-rr66.7%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 61.7%
Taylor expanded in z around inf 66.9%
unpow266.9%
associate-*r/66.9%
associate-*r*66.9%
metadata-eval66.9%
associate-*r*66.9%
neg-mul-166.9%
*-commutative66.9%
neg-mul-166.9%
*-commutative66.9%
associate-*l*66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in z around 0 66.9%
metadata-eval66.9%
times-frac66.9%
*-lft-identity66.9%
unpow266.9%
times-frac70.9%
metadata-eval70.9%
associate-/l*70.9%
/-rgt-identity70.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/70.9%
associate-/l*70.9%
Simplified70.9%
Final simplification64.7%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 4e-62)
(* (/ x y) (* 0.5 x))
(if (<= (* z z) 4e-35)
(* 0.5 y)
(if (<= (* z z) 2e+30)
(* 0.5 (/ x (/ y x)))
(if (<= (* z z) 2e+113)
(* (* z z) (/ -0.5 y))
(if (<= (* z z) 5e+190) (* 0.5 y) (/ z (/ (* y -2.0) z))))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z / ((y * -2.0) / 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 ((z * z) <= 4d-62) then
tmp = (x / y) * (0.5d0 * x)
else if ((z * z) <= 4d-35) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+30) then
tmp = 0.5d0 * (x / (y / x))
else if ((z * z) <= 2d+113) then
tmp = (z * z) * ((-0.5d0) / y)
else if ((z * z) <= 5d+190) then
tmp = 0.5d0 * y
else
tmp = z / ((y * (-2.0d0)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = (z * z) * (-0.5 / y);
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z / ((y * -2.0) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4e-62: tmp = (x / y) * (0.5 * x) elif (z * z) <= 4e-35: tmp = 0.5 * y elif (z * z) <= 2e+30: tmp = 0.5 * (x / (y / x)) elif (z * z) <= 2e+113: tmp = (z * z) * (-0.5 / y) elif (z * z) <= 5e+190: tmp = 0.5 * y else: tmp = z / ((y * -2.0) / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e-62) tmp = Float64(Float64(x / y) * Float64(0.5 * x)); elseif (Float64(z * z) <= 4e-35) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+30) tmp = Float64(0.5 * Float64(x / Float64(y / x))); elseif (Float64(z * z) <= 2e+113) tmp = Float64(Float64(z * z) * Float64(-0.5 / y)); elseif (Float64(z * z) <= 5e+190) tmp = Float64(0.5 * y); else tmp = Float64(z / Float64(Float64(y * -2.0) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e-62) tmp = (x / y) * (0.5 * x); elseif ((z * z) <= 4e-35) tmp = 0.5 * y; elseif ((z * z) <= 2e+30) tmp = 0.5 * (x / (y / x)); elseif ((z * z) <= 2e+113) tmp = (z * z) * (-0.5 / y); elseif ((z * z) <= 5e+190) tmp = 0.5 * y; else tmp = z / ((y * -2.0) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e-62], N[(N[(x / y), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e-35], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+113], N[(N[(z * z), $MachinePrecision] * N[(-0.5 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(0.5 * y), $MachinePrecision], N[(z / N[(N[(y * -2.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \frac{-0.5}{y}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y \cdot -2}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.0000000000000002e-62Initial program 77.4%
Taylor expanded in x around inf 55.4%
unpow255.4%
Simplified55.4%
Taylor expanded in x around 0 55.4%
*-commutative55.4%
unpow255.4%
associate-*l/60.1%
associate-*r*60.1%
Simplified60.1%
if 4.0000000000000002e-62 < (*.f64 z z) < 4.00000000000000003e-35 or 2e113 < (*.f64 z z) < 5.00000000000000036e190Initial program 78.8%
Taylor expanded in y around inf 59.7%
if 4.00000000000000003e-35 < (*.f64 z z) < 2e30Initial program 78.9%
Taylor expanded in x around inf 48.7%
unpow248.7%
associate-/l*62.6%
Simplified62.6%
if 2e30 < (*.f64 z z) < 2e113Initial program 89.0%
Taylor expanded in z around inf 66.5%
unpow266.5%
associate-*r/66.5%
associate-*r*66.5%
metadata-eval66.5%
associate-*r*66.5%
neg-mul-166.5%
*-commutative66.5%
neg-mul-166.5%
*-commutative66.5%
associate-*l*66.5%
metadata-eval66.5%
Simplified66.5%
frac-2neg66.5%
div-inv66.7%
distribute-rgt-neg-in66.7%
Applied egg-rr66.7%
associate-*r/66.5%
*-rgt-identity66.5%
distribute-rgt-neg-out66.5%
*-commutative66.5%
distribute-neg-frac66.5%
associate-/l*66.5%
distribute-neg-frac66.5%
neg-mul-166.5%
*-commutative66.5%
times-frac66.5%
metadata-eval66.5%
Simplified66.5%
*-un-lft-identity66.5%
*-commutative66.5%
times-frac66.5%
clear-num66.3%
frac-2neg66.3%
remove-double-neg66.3%
times-frac66.5%
metadata-eval66.5%
metadata-eval66.5%
div-inv66.5%
div-inv66.7%
clear-num66.7%
Applied egg-rr66.7%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 61.7%
Taylor expanded in z around inf 66.9%
unpow266.9%
associate-*r/66.9%
associate-*r*66.9%
metadata-eval66.9%
associate-*r*66.9%
neg-mul-166.9%
*-commutative66.9%
neg-mul-166.9%
*-commutative66.9%
associate-*l*66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in z around 0 66.9%
metadata-eval66.9%
times-frac66.9%
*-lft-identity66.9%
unpow266.9%
times-frac70.9%
metadata-eval70.9%
associate-/l*70.9%
/-rgt-identity70.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/70.9%
associate-/l*70.9%
Simplified70.9%
clear-num70.9%
un-div-inv70.9%
div-inv70.9%
metadata-eval70.9%
Applied egg-rr70.9%
Final simplification64.7%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 4e-62)
(* (/ x y) (* 0.5 x))
(if (<= (* z z) 4e-35)
(* 0.5 y)
(if (<= (* z z) 2e+30)
(* 0.5 (/ x (/ y x)))
(if (<= (* z z) 2e+113)
(/ (- z) (* y (/ 2.0 z)))
(if (<= (* z z) 5e+190) (* 0.5 y) (/ z (/ (* y -2.0) z))))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = -z / (y * (2.0 / z));
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z / ((y * -2.0) / 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 ((z * z) <= 4d-62) then
tmp = (x / y) * (0.5d0 * x)
else if ((z * z) <= 4d-35) then
tmp = 0.5d0 * y
else if ((z * z) <= 2d+30) then
tmp = 0.5d0 * (x / (y / x))
else if ((z * z) <= 2d+113) then
tmp = -z / (y * (2.0d0 / z))
else if ((z * z) <= 5d+190) then
tmp = 0.5d0 * y
else
tmp = z / ((y * (-2.0d0)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e-62) {
tmp = (x / y) * (0.5 * x);
} else if ((z * z) <= 4e-35) {
tmp = 0.5 * y;
} else if ((z * z) <= 2e+30) {
tmp = 0.5 * (x / (y / x));
} else if ((z * z) <= 2e+113) {
tmp = -z / (y * (2.0 / z));
} else if ((z * z) <= 5e+190) {
tmp = 0.5 * y;
} else {
tmp = z / ((y * -2.0) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4e-62: tmp = (x / y) * (0.5 * x) elif (z * z) <= 4e-35: tmp = 0.5 * y elif (z * z) <= 2e+30: tmp = 0.5 * (x / (y / x)) elif (z * z) <= 2e+113: tmp = -z / (y * (2.0 / z)) elif (z * z) <= 5e+190: tmp = 0.5 * y else: tmp = z / ((y * -2.0) / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e-62) tmp = Float64(Float64(x / y) * Float64(0.5 * x)); elseif (Float64(z * z) <= 4e-35) tmp = Float64(0.5 * y); elseif (Float64(z * z) <= 2e+30) tmp = Float64(0.5 * Float64(x / Float64(y / x))); elseif (Float64(z * z) <= 2e+113) tmp = Float64(Float64(-z) / Float64(y * Float64(2.0 / z))); elseif (Float64(z * z) <= 5e+190) tmp = Float64(0.5 * y); else tmp = Float64(z / Float64(Float64(y * -2.0) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e-62) tmp = (x / y) * (0.5 * x); elseif ((z * z) <= 4e-35) tmp = 0.5 * y; elseif ((z * z) <= 2e+30) tmp = 0.5 * (x / (y / x)); elseif ((z * z) <= 2e+113) tmp = -z / (y * (2.0 / z)); elseif ((z * z) <= 5e+190) tmp = 0.5 * y; else tmp = z / ((y * -2.0) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e-62], N[(N[(x / y), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e-35], N[(0.5 * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+113], N[((-z) / N[(y * N[(2.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(0.5 * y), $MachinePrecision], N[(z / N[(N[(y * -2.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-62}:\\
\;\;\;\;\frac{x}{y} \cdot \left(0.5 \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{-35}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\frac{-z}{y \cdot \frac{2}{z}}\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y \cdot -2}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.0000000000000002e-62Initial program 77.4%
Taylor expanded in x around inf 55.4%
unpow255.4%
Simplified55.4%
Taylor expanded in x around 0 55.4%
*-commutative55.4%
unpow255.4%
associate-*l/60.1%
associate-*r*60.1%
Simplified60.1%
if 4.0000000000000002e-62 < (*.f64 z z) < 4.00000000000000003e-35 or 2e113 < (*.f64 z z) < 5.00000000000000036e190Initial program 78.8%
Taylor expanded in y around inf 59.7%
if 4.00000000000000003e-35 < (*.f64 z z) < 2e30Initial program 78.9%
Taylor expanded in x around inf 48.7%
unpow248.7%
associate-/l*62.6%
Simplified62.6%
if 2e30 < (*.f64 z z) < 2e113Initial program 89.0%
Taylor expanded in z around inf 66.5%
unpow266.5%
associate-*r/66.5%
associate-*r*66.5%
metadata-eval66.5%
associate-*r*66.5%
neg-mul-166.5%
*-commutative66.5%
neg-mul-166.5%
*-commutative66.5%
associate-*l*66.5%
metadata-eval66.5%
Simplified66.5%
frac-2neg66.5%
div-inv66.7%
distribute-rgt-neg-in66.7%
Applied egg-rr66.7%
associate-*r/66.5%
*-rgt-identity66.5%
distribute-rgt-neg-out66.5%
*-commutative66.5%
distribute-neg-frac66.5%
associate-/l*66.5%
distribute-neg-frac66.5%
neg-mul-166.5%
*-commutative66.5%
times-frac66.5%
metadata-eval66.5%
Simplified66.5%
expm1-log1p-u66.1%
expm1-udef12.8%
Applied egg-rr12.8%
expm1-def66.1%
expm1-log1p66.5%
associate-*r/66.5%
associate-*l/66.7%
metadata-eval66.7%
associate-*r/66.7%
*-commutative66.7%
associate-*r/66.7%
metadata-eval66.7%
Simplified66.7%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 61.7%
Taylor expanded in z around inf 66.9%
unpow266.9%
associate-*r/66.9%
associate-*r*66.9%
metadata-eval66.9%
associate-*r*66.9%
neg-mul-166.9%
*-commutative66.9%
neg-mul-166.9%
*-commutative66.9%
associate-*l*66.9%
metadata-eval66.9%
Simplified66.9%
Taylor expanded in z around 0 66.9%
metadata-eval66.9%
times-frac66.9%
*-lft-identity66.9%
unpow266.9%
times-frac70.9%
metadata-eval70.9%
associate-/l*70.9%
/-rgt-identity70.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/70.9%
associate-/l*70.9%
Simplified70.9%
clear-num70.9%
un-div-inv70.9%
div-inv70.9%
metadata-eval70.9%
Applied egg-rr70.9%
Final simplification64.7%
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 2e+30)
(* 0.5 (+ y (* x (/ x y))))
(if (or (<= (* z z) 5e+157) (not (<= (* z z) 2e+221)))
(* 0.5 (- y (/ z (/ y z))))
(* 0.5 (/ (+ z x) (/ y (- x z)))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+30) {
tmp = 0.5 * (y + (x * (x / y)));
} else if (((z * z) <= 5e+157) || !((z * z) <= 2e+221)) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = 0.5 * ((z + x) / (y / (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 ((z * z) <= 2d+30) then
tmp = 0.5d0 * (y + (x * (x / y)))
else if (((z * z) <= 5d+157) .or. (.not. ((z * z) <= 2d+221))) then
tmp = 0.5d0 * (y - (z / (y / z)))
else
tmp = 0.5d0 * ((z + x) / (y / (x - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+30) {
tmp = 0.5 * (y + (x * (x / y)));
} else if (((z * z) <= 5e+157) || !((z * z) <= 2e+221)) {
tmp = 0.5 * (y - (z / (y / z)));
} else {
tmp = 0.5 * ((z + x) / (y / (x - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e+30: tmp = 0.5 * (y + (x * (x / y))) elif ((z * z) <= 5e+157) or not ((z * z) <= 2e+221): tmp = 0.5 * (y - (z / (y / z))) else: tmp = 0.5 * ((z + x) / (y / (x - z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+30) tmp = Float64(0.5 * Float64(y + Float64(x * Float64(x / y)))); elseif ((Float64(z * z) <= 5e+157) || !(Float64(z * z) <= 2e+221)) tmp = Float64(0.5 * Float64(y - Float64(z / Float64(y / z)))); else tmp = Float64(0.5 * Float64(Float64(z + x) / Float64(y / Float64(x - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e+30) tmp = 0.5 * (y + (x * (x / y))); elseif (((z * z) <= 5e+157) || ~(((z * z) <= 2e+221))) tmp = 0.5 * (y - (z / (y / z))); else tmp = 0.5 * ((z + x) / (y / (x - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+30], N[(0.5 * N[(y + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(z * z), $MachinePrecision], 5e+157], N[Not[LessEqual[N[(z * z), $MachinePrecision], 2e+221]], $MachinePrecision]], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(z + x), $MachinePrecision] / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+30}:\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \frac{x}{y}\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+157} \lor \neg \left(z \cdot z \leq 2 \cdot 10^{+221}\right):\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{z + x}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 2e30Initial program 77.9%
Taylor expanded in y around 0 93.3%
distribute-lft-out93.3%
+-lft-identity93.3%
mul0-lft93.3%
metadata-eval93.3%
distribute-lft1-in93.3%
unpow293.3%
unpow293.3%
sub-neg93.3%
mul-1-neg93.3%
unpow293.3%
+-commutative93.3%
unpow293.3%
distribute-lft1-in93.3%
metadata-eval93.3%
mul0-lft93.3%
+-lft-identity93.3%
Simplified99.9%
*-un-lft-identity99.9%
div-inv99.8%
times-frac93.2%
Applied egg-rr93.2%
Taylor expanded in z around 0 89.1%
unpow289.1%
associate-*r/95.7%
Simplified95.7%
if 2e30 < (*.f64 z z) < 4.99999999999999976e157 or 2.0000000000000001e221 < (*.f64 z z) Initial program 61.6%
Taylor expanded in x around 0 62.8%
unpow262.8%
unpow262.8%
div-sub62.8%
associate-/l*75.5%
*-inverses75.5%
/-rgt-identity75.5%
associate-/l*89.1%
Simplified89.1%
if 4.99999999999999976e157 < (*.f64 z z) < 2.0000000000000001e221Initial program 92.8%
Taylor expanded in y around 0 84.8%
unpow284.8%
unpow284.8%
difference-of-squares84.8%
associate-/l*84.8%
+-commutative84.8%
Simplified84.8%
Final simplification92.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 0.5 (/ x (/ y x)))))
(if (<= z 1.75e-253)
t_0
(if (<= z 3.1e-220)
(* 0.5 y)
(if (<= z 3.2e-31)
t_0
(if (<= z 6.6e-18)
(* 0.5 y)
(if (<= z 7.2e+21)
t_0
(if (or (<= z 1.22e+57) (not (<= z 1.85e+95)))
(* z (/ z (/ y -0.5)))
(* 0.5 y)))))))))
double code(double x, double y, double z) {
double t_0 = 0.5 * (x / (y / x));
double tmp;
if (z <= 1.75e-253) {
tmp = t_0;
} else if (z <= 3.1e-220) {
tmp = 0.5 * y;
} else if (z <= 3.2e-31) {
tmp = t_0;
} else if (z <= 6.6e-18) {
tmp = 0.5 * y;
} else if (z <= 7.2e+21) {
tmp = t_0;
} else if ((z <= 1.22e+57) || !(z <= 1.85e+95)) {
tmp = z * (z / (y / -0.5));
} else {
tmp = 0.5 * y;
}
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 <= 1.75d-253) then
tmp = t_0
else if (z <= 3.1d-220) then
tmp = 0.5d0 * y
else if (z <= 3.2d-31) then
tmp = t_0
else if (z <= 6.6d-18) then
tmp = 0.5d0 * y
else if (z <= 7.2d+21) then
tmp = t_0
else if ((z <= 1.22d+57) .or. (.not. (z <= 1.85d+95))) then
tmp = z * (z / (y / (-0.5d0)))
else
tmp = 0.5d0 * y
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 <= 1.75e-253) {
tmp = t_0;
} else if (z <= 3.1e-220) {
tmp = 0.5 * y;
} else if (z <= 3.2e-31) {
tmp = t_0;
} else if (z <= 6.6e-18) {
tmp = 0.5 * y;
} else if (z <= 7.2e+21) {
tmp = t_0;
} else if ((z <= 1.22e+57) || !(z <= 1.85e+95)) {
tmp = z * (z / (y / -0.5));
} else {
tmp = 0.5 * y;
}
return tmp;
}
def code(x, y, z): t_0 = 0.5 * (x / (y / x)) tmp = 0 if z <= 1.75e-253: tmp = t_0 elif z <= 3.1e-220: tmp = 0.5 * y elif z <= 3.2e-31: tmp = t_0 elif z <= 6.6e-18: tmp = 0.5 * y elif z <= 7.2e+21: tmp = t_0 elif (z <= 1.22e+57) or not (z <= 1.85e+95): tmp = z * (z / (y / -0.5)) else: tmp = 0.5 * y return tmp
function code(x, y, z) t_0 = Float64(0.5 * Float64(x / Float64(y / x))) tmp = 0.0 if (z <= 1.75e-253) tmp = t_0; elseif (z <= 3.1e-220) tmp = Float64(0.5 * y); elseif (z <= 3.2e-31) tmp = t_0; elseif (z <= 6.6e-18) tmp = Float64(0.5 * y); elseif (z <= 7.2e+21) tmp = t_0; elseif ((z <= 1.22e+57) || !(z <= 1.85e+95)) tmp = Float64(z * Float64(z / Float64(y / -0.5))); else tmp = Float64(0.5 * y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.5 * (x / (y / x)); tmp = 0.0; if (z <= 1.75e-253) tmp = t_0; elseif (z <= 3.1e-220) tmp = 0.5 * y; elseif (z <= 3.2e-31) tmp = t_0; elseif (z <= 6.6e-18) tmp = 0.5 * y; elseif (z <= 7.2e+21) tmp = t_0; elseif ((z <= 1.22e+57) || ~((z <= 1.85e+95))) tmp = z * (z / (y / -0.5)); else tmp = 0.5 * y; 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[z, 1.75e-253], t$95$0, If[LessEqual[z, 3.1e-220], N[(0.5 * y), $MachinePrecision], If[LessEqual[z, 3.2e-31], t$95$0, If[LessEqual[z, 6.6e-18], N[(0.5 * y), $MachinePrecision], If[LessEqual[z, 7.2e+21], t$95$0, If[Or[LessEqual[z, 1.22e+57], N[Not[LessEqual[z, 1.85e+95]], $MachinePrecision]], N[(z * N[(z / N[(y / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{\frac{y}{x}}\\
\mathbf{if}\;z \leq 1.75 \cdot 10^{-253}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-220}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-31}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-18}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+21}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+57} \lor \neg \left(z \leq 1.85 \cdot 10^{+95}\right):\\
\;\;\;\;z \cdot \frac{z}{\frac{y}{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot y\\
\end{array}
\end{array}
if z < 1.75000000000000011e-253 or 3.10000000000000011e-220 < z < 3.20000000000000018e-31 or 6.6000000000000003e-18 < z < 7.2e21Initial program 75.3%
Taylor expanded in x around inf 40.3%
unpow240.3%
associate-/l*44.3%
Simplified44.3%
if 1.75000000000000011e-253 < z < 3.10000000000000011e-220 or 3.20000000000000018e-31 < z < 6.6000000000000003e-18 or 1.22e57 < z < 1.8500000000000001e95Initial program 64.2%
Taylor expanded in y around inf 62.0%
if 7.2e21 < z < 1.22e57 or 1.8500000000000001e95 < z Initial program 62.9%
Taylor expanded in z around inf 62.7%
unpow262.7%
associate-*r/62.7%
associate-*r*62.7%
metadata-eval62.7%
associate-*r*62.7%
neg-mul-162.7%
*-commutative62.7%
neg-mul-162.7%
*-commutative62.7%
associate-*l*62.7%
metadata-eval62.7%
Simplified62.7%
Taylor expanded in z around 0 62.7%
metadata-eval62.7%
times-frac62.7%
*-lft-identity62.7%
unpow262.7%
times-frac64.3%
metadata-eval64.3%
associate-/l*64.3%
/-rgt-identity64.3%
associate-*r/62.7%
*-commutative62.7%
associate-*r/64.3%
associate-/l*64.3%
Simplified64.3%
Final simplification49.9%
(FPCore (x y z)
:precision binary64
(if (or (<= (* z z) 2e+30)
(and (not (<= (* z z) 2e+113)) (<= (* z z) 5e+190)))
(* 0.5 (+ y (* x (/ x y))))
(* 0.5 (- y (/ z (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (((z * z) <= 2e+30) || (!((z * z) <= 2e+113) && ((z * z) <= 5e+190))) {
tmp = 0.5 * (y + (x * (x / y)));
} 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 (((z * z) <= 2d+30) .or. (.not. ((z * z) <= 2d+113)) .and. ((z * z) <= 5d+190)) then
tmp = 0.5d0 * (y + (x * (x / y)))
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 (((z * z) <= 2e+30) || (!((z * z) <= 2e+113) && ((z * z) <= 5e+190))) {
tmp = 0.5 * (y + (x * (x / y)));
} else {
tmp = 0.5 * (y - (z / (y / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((z * z) <= 2e+30) or (not ((z * z) <= 2e+113) and ((z * z) <= 5e+190)): tmp = 0.5 * (y + (x * (x / y))) else: tmp = 0.5 * (y - (z / (y / z))) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(z * z) <= 2e+30) || (!(Float64(z * z) <= 2e+113) && (Float64(z * z) <= 5e+190))) tmp = Float64(0.5 * Float64(y + Float64(x * Float64(x / y)))); 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 (((z * z) <= 2e+30) || (~(((z * z) <= 2e+113)) && ((z * z) <= 5e+190))) tmp = 0.5 * (y + (x * (x / y))); else tmp = 0.5 * (y - (z / (y / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(z * z), $MachinePrecision], 2e+30], And[N[Not[LessEqual[N[(z * z), $MachinePrecision], 2e+113]], $MachinePrecision], LessEqual[N[(z * z), $MachinePrecision], 5e+190]]], N[(0.5 * N[(y + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y - N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+30} \lor \neg \left(z \cdot z \leq 2 \cdot 10^{+113}\right) \land z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y - \frac{z}{\frac{y}{z}}\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e30 or 2e113 < (*.f64 z z) < 5.00000000000000036e190Initial program 77.7%
Taylor expanded in y around 0 93.8%
distribute-lft-out93.8%
+-lft-identity93.8%
mul0-lft93.8%
metadata-eval93.8%
distribute-lft1-in93.8%
unpow293.8%
unpow293.8%
sub-neg93.8%
mul-1-neg93.8%
unpow293.8%
+-commutative93.8%
unpow293.8%
distribute-lft1-in93.8%
metadata-eval93.8%
mul0-lft93.8%
+-lft-identity93.8%
Simplified99.9%
*-un-lft-identity99.9%
div-inv99.9%
times-frac93.7%
Applied egg-rr93.7%
Taylor expanded in z around 0 89.3%
unpow289.3%
associate-*r/95.3%
Simplified95.3%
if 2e30 < (*.f64 z z) < 2e113 or 5.00000000000000036e190 < (*.f64 z z) Initial program 63.9%
Taylor expanded in x around 0 63.3%
unpow263.3%
unpow263.3%
div-sub63.3%
associate-/l*74.1%
*-inverses74.1%
/-rgt-identity74.1%
associate-/l*87.5%
Simplified87.5%
Final simplification92.0%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 5e+246) (* 0.5 (+ y (* x (/ x y)))) (* z (/ z (/ y -0.5)))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+246) {
tmp = 0.5 * (y + (x * (x / y)));
} else {
tmp = z * (z / (y / -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 ((z * z) <= 5d+246) then
tmp = 0.5d0 * (y + (x * (x / y)))
else
tmp = z * (z / (y / (-0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+246) {
tmp = 0.5 * (y + (x * (x / y)));
} else {
tmp = z * (z / (y / -0.5));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 5e+246: tmp = 0.5 * (y + (x * (x / y))) else: tmp = z * (z / (y / -0.5)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e+246) tmp = Float64(0.5 * Float64(y + Float64(x * Float64(x / y)))); else tmp = Float64(z * Float64(z / Float64(y / -0.5))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 5e+246) tmp = 0.5 * (y + (x * (x / y))); else tmp = z * (z / (y / -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+246], N[(0.5 * N[(y + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z / N[(y / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+246}:\\
\;\;\;\;0.5 \cdot \left(y + x \cdot \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{z}{\frac{y}{-0.5}}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999976e246Initial program 78.4%
Taylor expanded in y around 0 94.7%
distribute-lft-out94.7%
+-lft-identity94.7%
mul0-lft94.7%
metadata-eval94.7%
distribute-lft1-in94.7%
unpow294.7%
unpow294.7%
sub-neg94.7%
mul-1-neg94.7%
unpow294.7%
+-commutative94.7%
unpow294.7%
distribute-lft1-in94.7%
metadata-eval94.7%
mul0-lft94.7%
+-lft-identity94.7%
Simplified99.9%
*-un-lft-identity99.9%
div-inv99.9%
times-frac94.6%
Applied egg-rr94.6%
Taylor expanded in z around 0 82.9%
unpow282.9%
associate-*r/88.0%
Simplified88.0%
if 4.99999999999999976e246 < (*.f64 z z) Initial program 57.9%
Taylor expanded in z around inf 71.8%
unpow271.8%
associate-*r/71.8%
associate-*r*71.8%
metadata-eval71.8%
associate-*r*71.8%
neg-mul-171.8%
*-commutative71.8%
neg-mul-171.8%
*-commutative71.8%
associate-*l*71.8%
metadata-eval71.8%
Simplified71.8%
Taylor expanded in z around 0 71.8%
metadata-eval71.8%
times-frac71.8%
*-lft-identity71.8%
unpow271.8%
times-frac76.6%
metadata-eval76.6%
associate-/l*76.6%
/-rgt-identity76.6%
associate-*r/71.8%
*-commutative71.8%
associate-*r/76.6%
associate-/l*76.6%
Simplified76.6%
Final simplification84.3%
(FPCore (x y z) :precision binary64 (if (<= x 1.85e-16) (* 0.5 y) (* 0.5 (/ x (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.85e-16) {
tmp = 0.5 * y;
} 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 <= 1.85d-16) then
tmp = 0.5d0 * y
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 <= 1.85e-16) {
tmp = 0.5 * y;
} else {
tmp = 0.5 * (x / (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.85e-16: tmp = 0.5 * y else: tmp = 0.5 * (x / (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.85e-16) tmp = Float64(0.5 * y); 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 <= 1.85e-16) tmp = 0.5 * y; else tmp = 0.5 * (x / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.85e-16], N[(0.5 * y), $MachinePrecision], N[(0.5 * N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.85 \cdot 10^{-16}:\\
\;\;\;\;0.5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 1.85e-16Initial program 70.4%
Taylor expanded in y around inf 39.8%
if 1.85e-16 < x Initial program 74.9%
Taylor expanded in x around inf 58.7%
unpow258.7%
associate-/l*61.9%
Simplified61.9%
Final simplification46.5%
(FPCore (x y z) :precision binary64 (* 0.5 y))
double code(double x, double y, double z) {
return 0.5 * y;
}
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
public static double code(double x, double y, double z) {
return 0.5 * y;
}
def code(x, y, z): return 0.5 * y
function code(x, y, z) return Float64(0.5 * y) end
function tmp = code(x, y, z) tmp = 0.5 * y; end
code[x_, y_, z_] := N[(0.5 * y), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot y
\end{array}
Initial program 71.8%
Taylor expanded in y around inf 30.7%
Final simplification30.7%
(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 2023279
(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)))