
(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 10 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)))) (if (<= t_0 5e+265) (/ t_0 z) (/ (/ (* (cosh x) y) z) x))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= 5e+265) {
tmp = t_0 / 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) :: t_0
real(8) :: tmp
t_0 = cosh(x) * (y / x)
if (t_0 <= 5d+265) then
tmp = t_0 / 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 t_0 = Math.cosh(x) * (y / x);
double tmp;
if (t_0 <= 5e+265) {
tmp = t_0 / z;
} else {
tmp = ((Math.cosh(x) * y) / z) / x;
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= 5e+265: tmp = t_0 / z else: tmp = ((math.cosh(x) * y) / z) / x return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= 5e+265) tmp = Float64(t_0 / z); else tmp = Float64(Float64(Float64(cosh(x) * y) / z) / x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= 5e+265) tmp = t_0 / z; else tmp = ((cosh(x) * y) / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+265], N[(t$95$0 / z), $MachinePrecision], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+265}:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 5.0000000000000002e265Initial program 97.5%
if 5.0000000000000002e265 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 64.3%
associate-*l/64.3%
Simplified64.3%
associate-*r/100.0%
associate-*l/100.0%
Applied egg-rr100.0%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (cosh x) (/ y x)))) (if (<= t_0 INFINITY) (/ t_0 z) (* y (* x (/ 0.5 z))))))
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0 / z;
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(x) * (y / x);
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 / z;
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): t_0 = math.cosh(x) * (y / x) tmp = 0 if t_0 <= math.inf: tmp = t_0 / z else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= Inf) tmp = Float64(t_0 / z); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = cosh(x) * (y / x); tmp = 0.0; if (t_0 <= Inf) tmp = t_0 / z; else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 / z), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < +inf.0Initial program 95.3%
if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 0.0%
Taylor expanded in x around 0 7.2%
Taylor expanded in x around inf 7.2%
associate-/l*7.1%
Simplified7.1%
Taylor expanded in x around 0 7.2%
associate-*r/7.2%
associate-*r*7.2%
*-commutative7.2%
associate-*l/37.5%
*-commutative37.5%
associate-*r/37.5%
Simplified37.5%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (* (/ y x) (/ (cosh x) z)))
double code(double x, double y, double z) {
return (y / x) * (cosh(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) * (cosh(x) / z)
end function
public static double code(double x, double y, double z) {
return (y / x) * (Math.cosh(x) / z);
}
def code(x, y, z): return (y / x) * (math.cosh(x) / z)
function code(x, y, z) return Float64(Float64(y / x) * Float64(cosh(x) / z)) end
function tmp = code(x, y, z) tmp = (y / x) * (cosh(x) / z); end
code[x_, y_, z_] := N[(N[(y / x), $MachinePrecision] * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x} \cdot \frac{\cosh x}{z}
\end{array}
Initial program 84.9%
associate-*l/84.8%
Simplified84.8%
Final simplification84.8%
(FPCore (x y z) :precision binary64 (if (<= x -1e-8) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z) (if (<= x 1.42) (/ y (* x z)) (* y (* x (/ 0.5 z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1e-8) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = y * (x * (0.5 / 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 <= (-1d-8)) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z
else if (x <= 1.42d0) then
tmp = y / (x * z)
else
tmp = y * (x * (0.5d0 / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1e-8) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1e-8: tmp = (y * ((x * 0.5) + (1.0 / x))) / z elif x <= 1.42: tmp = y / (x * z) else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1e-8) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); elseif (x <= 1.42) tmp = Float64(y / Float64(x * z)); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1e-8) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; elseif (x <= 1.42) tmp = y / (x * z); else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1e-8], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[x, 1.42], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{elif}\;x \leq 1.42:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < -1e-8Initial program 81.7%
Taylor expanded in x around 0 47.5%
Taylor expanded in y around 0 47.5%
if -1e-8 < x < 1.4199999999999999Initial program 90.9%
associate-*l/90.7%
Simplified90.7%
Taylor expanded in x around 0 94.9%
if 1.4199999999999999 < x Initial program 78.3%
Taylor expanded in x around 0 34.6%
Taylor expanded in x around inf 34.6%
associate-/l*27.7%
Simplified27.7%
Taylor expanded in x around 0 34.6%
associate-*r/34.6%
associate-*r*34.6%
*-commutative34.6%
associate-*l/41.4%
*-commutative41.4%
associate-*r/41.4%
Simplified41.4%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e+24) (not (<= x 1.45))) (* 0.5 (/ x (/ z y))) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e+24) || !(x <= 1.45)) {
tmp = 0.5 * (x / (z / y));
} 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 <= (-3.5d+24)) .or. (.not. (x <= 1.45d0))) then
tmp = 0.5d0 * (x / (z / y))
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 <= -3.5e+24) || !(x <= 1.45)) {
tmp = 0.5 * (x / (z / y));
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e+24) or not (x <= 1.45): tmp = 0.5 * (x / (z / y)) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e+24) || !(x <= 1.45)) tmp = Float64(0.5 * Float64(x / Float64(z / y))); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.5e+24) || ~((x <= 1.45))) tmp = 0.5 * (x / (z / y)); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e+24], N[Not[LessEqual[x, 1.45]], $MachinePrecision]], N[(0.5 * N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+24} \lor \neg \left(x \leq 1.45\right):\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -3.5000000000000002e24 or 1.44999999999999996 < x Initial program 79.1%
Taylor expanded in x around 0 40.5%
Taylor expanded in x around inf 40.5%
associate-/l*32.7%
Simplified32.7%
if -3.5000000000000002e24 < x < 1.44999999999999996Initial program 91.3%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in x around 0 92.6%
Final simplification61.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e+24) (not (<= x 1.42))) (* y (* x (/ 0.5 z))) (/ y (* x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e+24) || !(x <= 1.42)) {
tmp = y * (x * (0.5 / 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 <= (-3.5d+24)) .or. (.not. (x <= 1.42d0))) then
tmp = y * (x * (0.5d0 / 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 <= -3.5e+24) || !(x <= 1.42)) {
tmp = y * (x * (0.5 / z));
} else {
tmp = y / (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e+24) or not (x <= 1.42): tmp = y * (x * (0.5 / z)) else: tmp = y / (x * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e+24) || !(x <= 1.42)) tmp = Float64(y * Float64(x * Float64(0.5 / z))); else tmp = Float64(y / Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.5e+24) || ~((x <= 1.42))) tmp = y * (x * (0.5 / z)); else tmp = y / (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e+24], N[Not[LessEqual[x, 1.42]], $MachinePrecision]], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+24} \lor \neg \left(x \leq 1.42\right):\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\end{array}
\end{array}
if x < -3.5000000000000002e24 or 1.4199999999999999 < x Initial program 79.1%
Taylor expanded in x around 0 40.5%
Taylor expanded in x around inf 40.5%
associate-/l*32.7%
Simplified32.7%
Taylor expanded in x around 0 40.5%
associate-*r/40.5%
associate-*r*40.5%
*-commutative40.5%
associate-*l/41.8%
*-commutative41.8%
associate-*r/41.8%
Simplified41.8%
if -3.5000000000000002e24 < x < 1.4199999999999999Initial program 91.3%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in x around 0 92.6%
Final simplification66.0%
(FPCore (x y z) :precision binary64 (if (<= x -3.5e+24) (* 0.5 (/ x (/ z y))) (if (<= x 1.42) (/ y (* x z)) (* x (* 0.5 (/ y z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e+24) {
tmp = 0.5 * (x / (z / y));
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = x * (0.5 * (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 (x <= (-3.5d+24)) then
tmp = 0.5d0 * (x / (z / y))
else if (x <= 1.42d0) then
tmp = y / (x * z)
else
tmp = x * (0.5d0 * (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e+24) {
tmp = 0.5 * (x / (z / y));
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = x * (0.5 * (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.5e+24: tmp = 0.5 * (x / (z / y)) elif x <= 1.42: tmp = y / (x * z) else: tmp = x * (0.5 * (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.5e+24) tmp = Float64(0.5 * Float64(x / Float64(z / y))); elseif (x <= 1.42) tmp = Float64(y / Float64(x * z)); else tmp = Float64(x * Float64(0.5 * Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.5e+24) tmp = 0.5 * (x / (z / y)); elseif (x <= 1.42) tmp = y / (x * z); else tmp = x * (0.5 * (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.5e+24], N[(0.5 * N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.42], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+24}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;x \leq 1.42:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -3.5000000000000002e24Initial program 80.0%
Taylor expanded in x around 0 46.8%
Taylor expanded in x around inf 46.8%
associate-/l*38.0%
Simplified38.0%
if -3.5000000000000002e24 < x < 1.4199999999999999Initial program 91.3%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in x around 0 92.6%
if 1.4199999999999999 < x Initial program 78.3%
Taylor expanded in x around 0 34.6%
Taylor expanded in x around inf 34.6%
*-commutative34.6%
*-commutative34.6%
associate-*r*34.6%
Simplified34.6%
*-commutative34.6%
*-commutative34.6%
associate-/l*27.7%
*-commutative27.7%
associate-*l/27.7%
div-inv27.7%
clear-num27.8%
associate-*l*27.8%
Applied egg-rr27.8%
Final simplification61.3%
(FPCore (x y z) :precision binary64 (if (<= x -3.5e+24) (/ 0.5 (/ z (* x y))) (if (<= x 1.42) (/ y (* x z)) (* y (* x (/ 0.5 z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e+24) {
tmp = 0.5 / (z / (x * y));
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = y * (x * (0.5 / 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 <= (-3.5d+24)) then
tmp = 0.5d0 / (z / (x * y))
else if (x <= 1.42d0) then
tmp = y / (x * z)
else
tmp = y * (x * (0.5d0 / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e+24) {
tmp = 0.5 / (z / (x * y));
} else if (x <= 1.42) {
tmp = y / (x * z);
} else {
tmp = y * (x * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.5e+24: tmp = 0.5 / (z / (x * y)) elif x <= 1.42: tmp = y / (x * z) else: tmp = y * (x * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.5e+24) tmp = Float64(0.5 / Float64(z / Float64(x * y))); elseif (x <= 1.42) tmp = Float64(y / Float64(x * z)); else tmp = Float64(y * Float64(x * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.5e+24) tmp = 0.5 / (z / (x * y)); elseif (x <= 1.42) tmp = y / (x * z); else tmp = y * (x * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.5e+24], N[(0.5 / N[(z / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.42], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+24}:\\
\;\;\;\;\frac{0.5}{\frac{z}{x \cdot y}}\\
\mathbf{elif}\;x \leq 1.42:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < -3.5000000000000002e24Initial program 80.0%
Taylor expanded in x around 0 46.8%
Taylor expanded in x around inf 46.8%
associate-/l*38.0%
Simplified38.0%
clear-num38.0%
un-div-inv38.0%
associate-/l/46.8%
Applied egg-rr46.8%
if -3.5000000000000002e24 < x < 1.4199999999999999Initial program 91.3%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in x around 0 92.6%
if 1.4199999999999999 < x Initial program 78.3%
Taylor expanded in x around 0 34.6%
Taylor expanded in x around inf 34.6%
associate-/l*27.7%
Simplified27.7%
Taylor expanded in x around 0 34.6%
associate-*r/34.6%
associate-*r*34.6%
*-commutative34.6%
associate-*l/41.4%
*-commutative41.4%
associate-*r/41.4%
Simplified41.4%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (if (<= z -9e+29) (/ y (* x z)) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+29) {
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 <= (-9d+29)) 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 <= -9e+29) {
tmp = y / (x * z);
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+29: tmp = y / (x * z) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+29) 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 <= -9e+29) tmp = y / (x * z); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+29], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+29}:\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if z < -9.0000000000000005e29Initial program 86.9%
associate-*l/86.8%
Simplified86.8%
Taylor expanded in x around 0 57.4%
if -9.0000000000000005e29 < z Initial program 84.2%
associate-*l/84.1%
Simplified84.1%
associate-*r/99.2%
associate-*l/99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 49.0%
Final simplification51.2%
(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 84.9%
associate-*l/84.8%
Simplified84.8%
Taylor expanded in x around 0 47.0%
Final simplification47.0%
(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 2023336
(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))