
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(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 = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* (cosh x) (/ y x)) z))) (if (<= t_0 2e+297) t_0 (/ y (/ x (/ (cosh x) z))))))
double code(double x, double y, double z) {
double t_0 = (cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= 2e+297) {
tmp = t_0;
} else {
tmp = y / (x / (cosh(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) :: t_0
real(8) :: tmp
t_0 = (cosh(x) * (y / x)) / z
if (t_0 <= 2d+297) then
tmp = t_0
else
tmp = y / (x / (cosh(x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (Math.cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= 2e+297) {
tmp = t_0;
} else {
tmp = y / (x / (Math.cosh(x) / z));
}
return tmp;
}
def code(x, y, z): t_0 = (math.cosh(x) * (y / x)) / z tmp = 0 if t_0 <= 2e+297: tmp = t_0 else: tmp = y / (x / (math.cosh(x) / z)) return tmp
function code(x, y, z) t_0 = Float64(Float64(cosh(x) * Float64(y / x)) / z) tmp = 0.0 if (t_0 <= 2e+297) tmp = t_0; else tmp = Float64(y / Float64(x / Float64(cosh(x) / z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (cosh(x) * (y / x)) / z; tmp = 0.0; if (t_0 <= 2e+297) tmp = t_0; else tmp = y / (x / (cosh(x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+297], t$95$0, N[(y / N[(x / N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+297}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{x}{\frac{\cosh x}{z}}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 2e297Initial program 99.3%
if 2e297 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 59.1%
associate-*r/95.8%
associate-/l/78.9%
associate-*l/78.9%
*-commutative78.9%
*-commutative78.9%
Simplified78.9%
clear-num78.9%
un-div-inv78.9%
associate-/l*100.0%
Applied egg-rr100.0%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -4e-53) (not (<= x 9.2e-26))) (* y (/ (cosh x) (* x z))) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4e-53) || !(x <= 9.2e-26)) {
tmp = y * (cosh(x) / (x * z));
} else {
tmp = (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 ((x <= (-4d-53)) .or. (.not. (x <= 9.2d-26))) then
tmp = y * (cosh(x) / (x * z))
else
tmp = (y / x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4e-53) || !(x <= 9.2e-26)) {
tmp = y * (Math.cosh(x) / (x * z));
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4e-53) or not (x <= 9.2e-26): tmp = y * (math.cosh(x) / (x * z)) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4e-53) || !(x <= 9.2e-26)) tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4e-53) || ~((x <= 9.2e-26))) tmp = y * (cosh(x) / (x * z)); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4e-53], N[Not[LessEqual[x, 9.2e-26]], $MachinePrecision]], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-53} \lor \neg \left(x \leq 9.2 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if x < -4.00000000000000012e-53 or 9.20000000000000035e-26 < x Initial program 75.9%
associate-*r/99.3%
associate-/l/75.8%
associate-*l/75.9%
*-commutative75.9%
*-commutative75.9%
Simplified75.9%
if -4.00000000000000012e-53 < x < 9.20000000000000035e-26Initial program 96.6%
associate-*r/96.6%
associate-/l/88.6%
associate-*l/86.6%
*-commutative86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in x around 0 88.6%
*-commutative88.6%
associate-/r*96.6%
Simplified96.6%
Final simplification85.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.25e-66) (not (<= y 9.5e-306))) (* (cosh x) (/ (/ y z) x)) (* y (/ (cosh x) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e-66) || !(y <= 9.5e-306)) {
tmp = cosh(x) * ((y / z) / x);
} else {
tmp = y * (cosh(x) / (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 ((y <= (-1.25d-66)) .or. (.not. (y <= 9.5d-306))) then
tmp = cosh(x) * ((y / z) / x)
else
tmp = y * (cosh(x) / (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e-66) || !(y <= 9.5e-306)) {
tmp = Math.cosh(x) * ((y / z) / x);
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.25e-66) or not (y <= 9.5e-306): tmp = math.cosh(x) * ((y / z) / x) else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.25e-66) || !(y <= 9.5e-306)) tmp = Float64(cosh(x) * Float64(Float64(y / z) / x)); else tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.25e-66) || ~((y <= 9.5e-306))) tmp = cosh(x) * ((y / z) / x); else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.25e-66], N[Not[LessEqual[y, 9.5e-306]], $MachinePrecision]], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{-66} \lor \neg \left(y \leq 9.5 \cdot 10^{-306}\right):\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if y < -1.2499999999999999e-66 or 9.5e-306 < y Initial program 90.3%
associate-*r/86.0%
associate-/l/80.7%
associate-/r*89.8%
Simplified89.8%
if -1.2499999999999999e-66 < y < 9.5e-306Initial program 63.9%
associate-*r/99.9%
associate-/l/78.9%
associate-*l/78.3%
*-commutative78.3%
*-commutative78.3%
Simplified78.3%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -4e-94) (not (<= z 3.1e-136))) (/ y (/ x (/ (cosh x) z))) (* (cosh x) (/ (/ y z) x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4e-94) || !(z <= 3.1e-136)) {
tmp = y / (x / (cosh(x) / z));
} else {
tmp = cosh(x) * ((y / z) / 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 ((z <= (-4d-94)) .or. (.not. (z <= 3.1d-136))) then
tmp = y / (x / (cosh(x) / z))
else
tmp = cosh(x) * ((y / z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4e-94) || !(z <= 3.1e-136)) {
tmp = y / (x / (Math.cosh(x) / z));
} else {
tmp = Math.cosh(x) * ((y / z) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4e-94) or not (z <= 3.1e-136): tmp = y / (x / (math.cosh(x) / z)) else: tmp = math.cosh(x) * ((y / z) / x) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4e-94) || !(z <= 3.1e-136)) tmp = Float64(y / Float64(x / Float64(cosh(x) / z))); else tmp = Float64(cosh(x) * Float64(Float64(y / z) / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4e-94) || ~((z <= 3.1e-136))) tmp = y / (x / (cosh(x) / z)); else tmp = cosh(x) * ((y / z) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4e-94], N[Not[LessEqual[z, 3.1e-136]], $MachinePrecision]], N[(y / N[(x / N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-94} \lor \neg \left(z \leq 3.1 \cdot 10^{-136}\right):\\
\;\;\;\;\frac{y}{\frac{x}{\frac{\cosh x}{z}}}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if z < -3.9999999999999998e-94 or 3.1e-136 < z Initial program 85.9%
associate-*r/97.2%
associate-/l/80.1%
associate-*l/80.0%
*-commutative80.0%
*-commutative80.0%
Simplified80.0%
clear-num80.0%
un-div-inv80.1%
associate-/l*99.3%
Applied egg-rr99.3%
if -3.9999999999999998e-94 < z < 3.1e-136Initial program 83.6%
associate-*r/83.6%
associate-/l/84.8%
associate-/r*99.8%
Simplified99.8%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (* x y))))
(if (<= x -1.55e+155)
(/ (* y (+ (* x (* z 0.5)) (/ z x))) (/ x (/ x (* z z))))
(if (<= x -900.0)
(/ (+ (* z 0.5) (* (/ y x) t_0)) (* z t_0))
(if (<= x 1.32e+159)
(+ (/ (/ y x) z) (* 0.5 (* y (/ x z))))
(/ (* 0.5 (* y (* x z))) (* x (* z (/ z x)))))))))
double code(double x, double y, double z) {
double t_0 = z / (x * y);
double tmp;
if (x <= -1.55e+155) {
tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z)));
} else if (x <= -900.0) {
tmp = ((z * 0.5) + ((y / x) * t_0)) / (z * t_0);
} else if (x <= 1.32e+159) {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
} else {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / 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) :: t_0
real(8) :: tmp
t_0 = z / (x * y)
if (x <= (-1.55d+155)) then
tmp = (y * ((x * (z * 0.5d0)) + (z / x))) / (x / (x / (z * z)))
else if (x <= (-900.0d0)) then
tmp = ((z * 0.5d0) + ((y / x) * t_0)) / (z * t_0)
else if (x <= 1.32d+159) then
tmp = ((y / x) / z) + (0.5d0 * (y * (x / z)))
else
tmp = (0.5d0 * (y * (x * z))) / (x * (z * (z / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z / (x * y);
double tmp;
if (x <= -1.55e+155) {
tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z)));
} else if (x <= -900.0) {
tmp = ((z * 0.5) + ((y / x) * t_0)) / (z * t_0);
} else if (x <= 1.32e+159) {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
} else {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x)));
}
return tmp;
}
def code(x, y, z): t_0 = z / (x * y) tmp = 0 if x <= -1.55e+155: tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z))) elif x <= -900.0: tmp = ((z * 0.5) + ((y / x) * t_0)) / (z * t_0) elif x <= 1.32e+159: tmp = ((y / x) / z) + (0.5 * (y * (x / z))) else: tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))) return tmp
function code(x, y, z) t_0 = Float64(z / Float64(x * y)) tmp = 0.0 if (x <= -1.55e+155) tmp = Float64(Float64(y * Float64(Float64(x * Float64(z * 0.5)) + Float64(z / x))) / Float64(x / Float64(x / Float64(z * z)))); elseif (x <= -900.0) tmp = Float64(Float64(Float64(z * 0.5) + Float64(Float64(y / x) * t_0)) / Float64(z * t_0)); elseif (x <= 1.32e+159) tmp = Float64(Float64(Float64(y / x) / z) + Float64(0.5 * Float64(y * Float64(x / z)))); else tmp = Float64(Float64(0.5 * Float64(y * Float64(x * z))) / Float64(x * Float64(z * Float64(z / x)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z / (x * y); tmp = 0.0; if (x <= -1.55e+155) tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z))); elseif (x <= -900.0) tmp = ((z * 0.5) + ((y / x) * t_0)) / (z * t_0); elseif (x <= 1.32e+159) tmp = ((y / x) / z) + (0.5 * (y * (x / z))); else tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z / N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.55e+155], N[(N[(y * N[(N[(x * N[(z * 0.5), $MachinePrecision]), $MachinePrecision] + N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x / N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -900.0], N[(N[(N[(z * 0.5), $MachinePrecision] + N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.32e+159], N[(N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision] + N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{x \cdot y}\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{+155}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot \left(z \cdot 0.5\right) + \frac{z}{x}\right)}{\frac{x}{\frac{x}{z \cdot z}}}\\
\mathbf{elif}\;x \leq -900:\\
\;\;\;\;\frac{z \cdot 0.5 + \frac{y}{x} \cdot t_0}{z \cdot t_0}\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+159}:\\
\;\;\;\;\frac{\frac{y}{x}}{z} + 0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y \cdot \left(x \cdot z\right)\right)}{x \cdot \left(z \cdot \frac{z}{x}\right)}\\
\end{array}
\end{array}
if x < -1.54999999999999995e155Initial program 64.3%
associate-*r/100.0%
associate-/l/50.0%
associate-*l/50.0%
*-commutative50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in x around 0 34.8%
+-commutative34.8%
associate-/l*34.7%
*-commutative34.7%
associate-/r*34.7%
Simplified34.7%
associate-/l/34.7%
+-commutative34.7%
associate-*r/34.7%
frac-add26.1%
*-commutative26.1%
*-commutative26.1%
Applied egg-rr26.1%
+-commutative26.1%
associate-*r*26.1%
*-commutative26.1%
distribute-rgt-out26.1%
associate-*l*26.1%
associate-*l*57.9%
Simplified57.9%
expm1-log1p-u57.9%
expm1-udef64.8%
associate-*r/64.8%
Applied egg-rr64.8%
expm1-def57.9%
expm1-log1p57.9%
unpow257.9%
associate-*r/25.8%
associate-/l*61.4%
unpow261.4%
Simplified61.4%
if -1.54999999999999995e155 < x < -900Initial program 89.7%
associate-*r/100.0%
associate-/l/82.1%
associate-*l/82.1%
*-commutative82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in x around 0 31.1%
+-commutative31.1%
associate-/l*26.4%
*-commutative26.4%
associate-/r*26.4%
Simplified26.4%
Taylor expanded in y around 0 31.1%
associate-*r/26.4%
Simplified26.4%
fma-def26.4%
associate-*r/31.1%
*-commutative31.1%
clear-num31.1%
fma-def31.1%
+-commutative31.1%
un-div-inv31.1%
frac-add45.2%
*-commutative45.2%
*-commutative45.2%
Applied egg-rr45.2%
if -900 < x < 1.32000000000000007e159Initial program 92.3%
associate-*r/96.8%
associate-/l/87.7%
associate-*l/86.2%
*-commutative86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in x around 0 76.1%
+-commutative76.1%
associate-/l*78.0%
*-commutative78.0%
associate-/r*83.3%
Simplified83.3%
Taylor expanded in y around 0 81.4%
associate-*r/83.3%
Simplified83.3%
if 1.32000000000000007e159 < x Initial program 63.6%
associate-*r/100.0%
associate-/l/78.8%
associate-*l/78.8%
*-commutative78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in x around 0 47.9%
+-commutative47.9%
associate-/l*47.7%
*-commutative47.7%
associate-/r*47.7%
Simplified47.7%
associate-/l/47.7%
+-commutative47.7%
associate-*r/47.7%
frac-add55.4%
*-commutative55.4%
*-commutative55.4%
Applied egg-rr55.4%
+-commutative55.4%
associate-*r*55.4%
*-commutative55.4%
distribute-rgt-out55.4%
associate-*l*55.4%
associate-*l*70.1%
Simplified70.1%
Taylor expanded in x around inf 70.1%
Final simplification73.4%
(FPCore (x y z)
:precision binary64
(if (<= x -7.6e+18)
(/ (* y (+ (* x (* z 0.5)) (/ z x))) (/ x (/ x (* z z))))
(if (<= x 4.3e+157)
(+ (/ (/ y x) z) (* 0.5 (* y (/ x z))))
(/ (* 0.5 (* y (* x z))) (* x (* z (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e+18) {
tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z)));
} else if (x <= 4.3e+157) {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
} else {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / 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 <= (-7.6d+18)) then
tmp = (y * ((x * (z * 0.5d0)) + (z / x))) / (x / (x / (z * z)))
else if (x <= 4.3d+157) then
tmp = ((y / x) / z) + (0.5d0 * (y * (x / z)))
else
tmp = (0.5d0 * (y * (x * z))) / (x * (z * (z / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e+18) {
tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z)));
} else if (x <= 4.3e+157) {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
} else {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.6e+18: tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z))) elif x <= 4.3e+157: tmp = ((y / x) / z) + (0.5 * (y * (x / z))) else: tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.6e+18) tmp = Float64(Float64(y * Float64(Float64(x * Float64(z * 0.5)) + Float64(z / x))) / Float64(x / Float64(x / Float64(z * z)))); elseif (x <= 4.3e+157) tmp = Float64(Float64(Float64(y / x) / z) + Float64(0.5 * Float64(y * Float64(x / z)))); else tmp = Float64(Float64(0.5 * Float64(y * Float64(x * z))) / Float64(x * Float64(z * Float64(z / x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.6e+18) tmp = (y * ((x * (z * 0.5)) + (z / x))) / (x / (x / (z * z))); elseif (x <= 4.3e+157) tmp = ((y / x) / z) + (0.5 * (y * (x / z))); else tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.6e+18], N[(N[(y * N[(N[(x * N[(z * 0.5), $MachinePrecision]), $MachinePrecision] + N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x / N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.3e+157], N[(N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision] + N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+18}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot \left(z \cdot 0.5\right) + \frac{z}{x}\right)}{\frac{x}{\frac{x}{z \cdot z}}}\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+157}:\\
\;\;\;\;\frac{\frac{y}{x}}{z} + 0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y \cdot \left(x \cdot z\right)\right)}{x \cdot \left(z \cdot \frac{z}{x}\right)}\\
\end{array}
\end{array}
if x < -7.6e18Initial program 77.0%
associate-*r/100.0%
associate-/l/65.6%
associate-*l/65.6%
*-commutative65.6%
*-commutative65.6%
Simplified65.6%
Taylor expanded in x around 0 34.0%
+-commutative34.0%
associate-/l*30.9%
*-commutative30.9%
associate-/r*30.9%
Simplified30.9%
associate-/l/30.9%
+-commutative30.9%
associate-*r/30.9%
frac-add27.9%
*-commutative27.9%
*-commutative27.9%
Applied egg-rr27.9%
+-commutative27.9%
associate-*r*27.9%
*-commutative27.9%
distribute-rgt-out27.9%
associate-*l*27.9%
associate-*l*44.1%
Simplified44.1%
expm1-log1p-u44.1%
expm1-udef54.7%
associate-*r/54.7%
Applied egg-rr54.7%
expm1-def44.1%
expm1-log1p44.1%
unpow244.1%
associate-*r/26.1%
associate-/l*47.2%
unpow247.2%
Simplified47.2%
if -7.6e18 < x < 4.3e157Initial program 92.6%
associate-*r/96.9%
associate-/l/88.1%
associate-*l/86.7%
*-commutative86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 74.0%
+-commutative74.0%
associate-/l*75.8%
*-commutative75.8%
associate-/r*80.9%
Simplified80.9%
Taylor expanded in y around 0 79.1%
associate-*r/80.9%
Simplified80.9%
if 4.3e157 < x Initial program 63.6%
associate-*r/100.0%
associate-/l/78.8%
associate-*l/78.8%
*-commutative78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in x around 0 47.9%
+-commutative47.9%
associate-/l*47.7%
*-commutative47.7%
associate-/r*47.7%
Simplified47.7%
associate-/l/47.7%
+-commutative47.7%
associate-*r/47.7%
frac-add55.4%
*-commutative55.4%
*-commutative55.4%
Applied egg-rr55.4%
+-commutative55.4%
associate-*r*55.4%
*-commutative55.4%
distribute-rgt-out55.4%
associate-*l*55.4%
associate-*l*70.1%
Simplified70.1%
Taylor expanded in x around inf 70.1%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.1e+18) (not (<= x 9.4e+156))) (/ (* 0.5 (* y (* x z))) (* x (* z (/ z x)))) (+ (/ (/ y x) z) (* 0.5 (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.1e+18) || !(x <= 9.4e+156)) {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x)));
} else {
tmp = ((y / x) / z) + (0.5 * (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 ((x <= (-1.1d+18)) .or. (.not. (x <= 9.4d+156))) then
tmp = (0.5d0 * (y * (x * z))) / (x * (z * (z / x)))
else
tmp = ((y / x) / z) + (0.5d0 * (y * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.1e+18) || !(x <= 9.4e+156)) {
tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x)));
} else {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.1e+18) or not (x <= 9.4e+156): tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))) else: tmp = ((y / x) / z) + (0.5 * (y * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.1e+18) || !(x <= 9.4e+156)) tmp = Float64(Float64(0.5 * Float64(y * Float64(x * z))) / Float64(x * Float64(z * Float64(z / x)))); else tmp = Float64(Float64(Float64(y / x) / z) + Float64(0.5 * Float64(y * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.1e+18) || ~((x <= 9.4e+156))) tmp = (0.5 * (y * (x * z))) / (x * (z * (z / x))); else tmp = ((y / x) / z) + (0.5 * (y * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.1e+18], N[Not[LessEqual[x, 9.4e+156]], $MachinePrecision]], N[(N[(0.5 * N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision] + N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+18} \lor \neg \left(x \leq 9.4 \cdot 10^{+156}\right):\\
\;\;\;\;\frac{0.5 \cdot \left(y \cdot \left(x \cdot z\right)\right)}{x \cdot \left(z \cdot \frac{z}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z} + 0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if x < -1.1e18 or 9.4e156 < x Initial program 72.3%
associate-*r/100.0%
associate-/l/70.2%
associate-*l/70.2%
*-commutative70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in x around 0 38.8%
+-commutative38.8%
associate-/l*36.8%
*-commutative36.8%
associate-/r*36.8%
Simplified36.8%
associate-/l/36.8%
+-commutative36.8%
associate-*r/36.8%
frac-add37.6%
*-commutative37.6%
*-commutative37.6%
Applied egg-rr37.6%
+-commutative37.6%
associate-*r*37.6%
*-commutative37.6%
distribute-rgt-out37.6%
associate-*l*37.6%
associate-*l*53.2%
Simplified53.2%
Taylor expanded in x around inf 53.2%
if -1.1e18 < x < 9.4e156Initial program 92.6%
associate-*r/96.9%
associate-/l/88.1%
associate-*l/86.7%
*-commutative86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 74.0%
+-commutative74.0%
associate-/l*75.8%
*-commutative75.8%
associate-/r*80.9%
Simplified80.9%
Taylor expanded in y around 0 79.1%
associate-*r/80.9%
Simplified80.9%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (<= y -4e+85) (/ (+ (/ y x) (* 0.5 (* x y))) z) (+ (/ (/ y x) z) (* 0.5 (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+85) {
tmp = ((y / x) + (0.5 * (x * y))) / z;
} else {
tmp = ((y / x) / z) + (0.5 * (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 (y <= (-4d+85)) then
tmp = ((y / x) + (0.5d0 * (x * y))) / z
else
tmp = ((y / x) / z) + (0.5d0 * (y * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e+85) {
tmp = ((y / x) + (0.5 * (x * y))) / z;
} else {
tmp = ((y / x) / z) + (0.5 * (y * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+85: tmp = ((y / x) + (0.5 * (x * y))) / z else: tmp = ((y / x) / z) + (0.5 * (y * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+85) tmp = Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(x * y))) / z); else tmp = Float64(Float64(Float64(y / x) / z) + Float64(0.5 * Float64(y * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e+85) tmp = ((y / x) + (0.5 * (x * y))) / z; else tmp = ((y / x) / z) + (0.5 * (y * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+85], N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision] + N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+85}:\\
\;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z} + 0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -4.0000000000000001e85Initial program 93.5%
Taylor expanded in x around 0 82.9%
if -4.0000000000000001e85 < y Initial program 83.4%
associate-*r/99.0%
associate-/l/80.6%
associate-*l/79.5%
*-commutative79.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in x around 0 55.3%
+-commutative55.3%
associate-/l*60.2%
*-commutative60.2%
associate-/r*65.4%
Simplified65.4%
Taylor expanded in y around 0 60.5%
associate-*r/65.8%
Simplified65.8%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x 5000000000000.0) (/ (+ (/ y x) (* 0.5 (* x y))) z) (* 0.5 (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5000000000000.0) {
tmp = ((y / x) + (0.5 * (x * y))) / z;
} else {
tmp = 0.5 * (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 (x <= 5000000000000.0d0) then
tmp = ((y / x) + (0.5d0 * (x * y))) / z
else
tmp = 0.5d0 * (y * (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5000000000000.0) {
tmp = ((y / x) + (0.5 * (x * y))) / z;
} else {
tmp = 0.5 * (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5000000000000.0: tmp = ((y / x) + (0.5 * (x * y))) / z else: tmp = 0.5 * (y * (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5000000000000.0) tmp = Float64(Float64(Float64(y / x) + Float64(0.5 * Float64(x * y))) / z); else tmp = Float64(0.5 * Float64(y * Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5000000000000.0) tmp = ((y / x) + (0.5 * (x * y))) / z; else tmp = 0.5 * (y * (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5000000000000.0], N[(N[(N[(y / x), $MachinePrecision] + N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5000000000000:\\
\;\;\;\;\frac{\frac{y}{x} + 0.5 \cdot \left(x \cdot y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if x < 5e12Initial program 90.3%
Taylor expanded in x around 0 73.0%
if 5e12 < x Initial program 68.3%
Taylor expanded in x around 0 36.1%
Taylor expanded in x around inf 36.1%
associate-*r/43.9%
Simplified43.9%
Final simplification66.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.4))) (* 0.5 (* x (/ y z))) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = 0.5 * (x * (y / z));
} else {
tmp = (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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (x * (y / z))
else
tmp = (y / x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = 0.5 * (x * (y / z));
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.4): tmp = 0.5 * (x * (y / z)) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.4)) tmp = Float64(0.5 * Float64(x * Float64(y / z))); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.4))) tmp = 0.5 * (x * (y / z)); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.3999999999999999 < x Initial program 74.8%
Taylor expanded in x around 0 34.1%
Taylor expanded in x around inf 34.1%
associate-*l/26.2%
*-commutative26.2%
Simplified26.2%
if -1.3999999999999999 < x < 1.3999999999999999Initial program 96.0%
associate-*r/96.0%
associate-/l/89.4%
associate-*l/87.6%
*-commutative87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around 0 89.4%
*-commutative89.4%
associate-/r*96.0%
Simplified96.0%
Final simplification60.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4) (not (<= x 1.4))) (* 0.5 (* y (/ x z))) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (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 ((x <= (-1.4d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (y * (x / z))
else
tmp = (y / x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4) || !(x <= 1.4)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4) or not (x <= 1.4): tmp = 0.5 * (y * (x / z)) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4) || !(x <= 1.4)) tmp = Float64(0.5 * Float64(y * Float64(x / z))); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4) || ~((x <= 1.4))) tmp = 0.5 * (y * (x / z)); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if x < -1.3999999999999999 or 1.3999999999999999 < x Initial program 74.8%
Taylor expanded in x around 0 34.1%
Taylor expanded in x around inf 34.1%
associate-*r/35.6%
Simplified35.6%
if -1.3999999999999999 < x < 1.3999999999999999Initial program 96.0%
associate-*r/96.0%
associate-/l/89.4%
associate-*l/87.6%
*-commutative87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around 0 89.4%
*-commutative89.4%
associate-/r*96.0%
Simplified96.0%
Final simplification65.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.4) (/ (* 0.5 (* x y)) z) (if (<= x 1.4) (/ (/ y x) z) (* 0.5 (* y (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4) {
tmp = (0.5 * (x * y)) / z;
} else if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = 0.5 * (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 (x <= (-1.4d0)) then
tmp = (0.5d0 * (x * y)) / z
else if (x <= 1.4d0) then
tmp = (y / x) / z
else
tmp = 0.5d0 * (y * (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4) {
tmp = (0.5 * (x * y)) / z;
} else if (x <= 1.4) {
tmp = (y / x) / z;
} else {
tmp = 0.5 * (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4: tmp = (0.5 * (x * y)) / z elif x <= 1.4: tmp = (y / x) / z else: tmp = 0.5 * (y * (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4) tmp = Float64(Float64(0.5 * Float64(x * y)) / z); elseif (x <= 1.4) tmp = Float64(Float64(y / x) / z); else tmp = Float64(0.5 * Float64(y * Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4) tmp = (0.5 * (x * y)) / z; elseif (x <= 1.4) tmp = (y / x) / z; else tmp = 0.5 * (y * (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4], N[(N[(0.5 * N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4:\\
\;\;\;\;\frac{0.5 \cdot \left(x \cdot y\right)}{z}\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if x < -1.3999999999999999Initial program 79.1%
Taylor expanded in x around 0 32.7%
Taylor expanded in x around inf 32.7%
if -1.3999999999999999 < x < 1.3999999999999999Initial program 96.0%
associate-*r/96.0%
associate-/l/89.4%
associate-*l/87.6%
*-commutative87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around 0 89.4%
*-commutative89.4%
associate-/r*96.0%
Simplified96.0%
if 1.3999999999999999 < x Initial program 70.3%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 35.6%
associate-*r/41.5%
Simplified41.5%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= z -5e+66) (/ y (* x z)) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5e+66) {
tmp = y / (x * z);
} else {
tmp = (y / z) / 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 (z <= (-5d+66)) then
tmp = y / (x * z)
else
tmp = (y / z) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e+66) {
tmp = y / (x * z);
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e+66: tmp = y / (x * z) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e+66) tmp = Float64(y / Float64(x * z)); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e+66) tmp = y / (x * z); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5e+66], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+66}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if z < -4.99999999999999991e66Initial program 79.8%
associate-*r/95.7%
associate-/l/72.6%
associate-*l/72.3%
*-commutative72.3%
*-commutative72.3%
Simplified72.3%
Taylor expanded in x around 0 59.7%
if -4.99999999999999991e66 < z Initial program 86.3%
associate-*r/98.6%
associate-/l/83.4%
associate-*l/82.4%
*-commutative82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in x around 0 43.2%
div-inv44.3%
associate-/r*51.7%
Applied egg-rr51.7%
Final simplification53.1%
(FPCore (x y z) :precision binary64 (/ y (* x z)))
double code(double x, double y, double z) {
return 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 = y / (x * z)
end function
public static double code(double x, double y, double z) {
return y / (x * z);
}
def code(x, y, z): return y / (x * z)
function code(x, y, z) return Float64(y / Float64(x * z)) end
function tmp = code(x, y, z) tmp = y / (x * z); end
code[x_, y_, z_] := N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x \cdot z}
\end{array}
Initial program 85.2%
associate-*r/98.1%
associate-/l/81.6%
associate-*l/80.7%
*-commutative80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in x around 0 46.9%
Final simplification46.9%
(FPCore (x y z) :precision binary64 (/ (/ y x) z))
double code(double x, double y, double z) {
return (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 = (y / x) / z
end function
public static double code(double x, double y, double z) {
return (y / x) / z;
}
def code(x, y, z): return (y / x) / z
function code(x, y, z) return Float64(Float64(y / x) / z) end
function tmp = code(x, y, z) tmp = (y / x) / z; end
code[x_, y_, z_] := N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{x}}{z}
\end{array}
Initial program 85.2%
associate-*r/98.1%
associate-/l/81.6%
associate-*l/80.7%
*-commutative80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in x around 0 46.9%
*-commutative46.9%
associate-/r*50.1%
Simplified50.1%
Final simplification50.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (/ y z) x) (cosh x))))
(if (< y -4.618902267687042e-52)
t_0
(if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((cosh(x) * y) / x) / z;
} 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) :: tmp
t_0 = ((y / z) / x) * cosh(x)
if (y < (-4.618902267687042d-52)) then
tmp = t_0
else if (y < 1.038530535935153d-39) then
tmp = ((cosh(x) * y) / x) / z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y / z) / x) * Math.cosh(x);
double tmp;
if (y < -4.618902267687042e-52) {
tmp = t_0;
} else if (y < 1.038530535935153e-39) {
tmp = ((Math.cosh(x) * y) / x) / z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y / z) / x) * math.cosh(x) tmp = 0 if y < -4.618902267687042e-52: tmp = t_0 elif y < 1.038530535935153e-39: tmp = ((math.cosh(x) * y) / x) / z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y / z) / x) * cosh(x)) tmp = 0.0 if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = Float64(Float64(Float64(cosh(x) * y) / x) / z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y / z) / x) * cosh(x); tmp = 0.0; if (y < -4.618902267687042e-52) tmp = t_0; elseif (y < 1.038530535935153e-39) tmp = ((cosh(x) * y) / x) / z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -4.618902267687042e-52], t$95$0, If[Less[y, 1.038530535935153e-39], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{z}}{x} \cdot \cosh x\\
\mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023196
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))