
(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 14 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 (if (<= y 1.4e+67) (/ (* y (/ (cosh x) x)) z) (/ (cosh x) (* x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.4e+67) {
tmp = (y * (cosh(x) / x)) / z;
} else {
tmp = cosh(x) / (x * (z / 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) :: tmp
if (y <= 1.4d+67) then
tmp = (y * (cosh(x) / x)) / z
else
tmp = cosh(x) / (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.4e+67) {
tmp = (y * (Math.cosh(x) / x)) / z;
} else {
tmp = Math.cosh(x) / (x * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.4e+67: tmp = (y * (math.cosh(x) / x)) / z else: tmp = math.cosh(x) / (x * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.4e+67) tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z); else tmp = Float64(cosh(x) / Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.4e+67) tmp = (y * (cosh(x) / x)) / z; else tmp = cosh(x) / (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.4e+67], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] / N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{+67}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}
\end{array}
if y < 1.3999999999999999e67Initial program 84.2%
associate-*r/75.3%
associate-/l/74.8%
associate-/r*80.2%
Simplified80.2%
associate-/l/74.8%
associate-*r/82.2%
associate-*l/81.6%
associate-/r*94.4%
associate-*l/97.5%
Applied egg-rr97.5%
if 1.3999999999999999e67 < y Initial program 82.3%
associate-/l*82.2%
associate-/r/99.9%
Simplified99.9%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (cosh x) (/ y x)))) (if (<= t_0 INFINITY) (/ t_0 z) (* y (/ (cosh x) (* x 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 * (cosh(x) / (x * 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 * (Math.cosh(x) / (x * 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 * (math.cosh(x) / (x * 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(cosh(x) / Float64(x * 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 * (cosh(x) / (x * 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[(N[Cosh[x], $MachinePrecision] / N[(x * 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 \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < +inf.0Initial program 93.7%
if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 0.0%
associate-*r/100.0%
associate-/l/77.8%
associate-*l/77.8%
*-commutative77.8%
*-commutative77.8%
Simplified77.8%
Final simplification92.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.35e-157) (not (<= y 8.2e-52))) (* (cosh x) (/ (/ y z) x)) (* y (/ (cosh x) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.35e-157) || !(y <= 8.2e-52)) {
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.35d-157)) .or. (.not. (y <= 8.2d-52))) 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.35e-157) || !(y <= 8.2e-52)) {
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.35e-157) or not (y <= 8.2e-52): 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.35e-157) || !(y <= 8.2e-52)) 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.35e-157) || ~((y <= 8.2e-52))) 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.35e-157], N[Not[LessEqual[y, 8.2e-52]], $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.35 \cdot 10^{-157} \lor \neg \left(y \leq 8.2 \cdot 10^{-52}\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.35e-157 or 8.19999999999999977e-52 < y Initial program 91.1%
associate-*r/85.4%
associate-/l/82.2%
associate-/r*93.5%
Simplified93.5%
if -1.35e-157 < y < 8.19999999999999977e-52Initial program 68.5%
associate-*r/99.8%
associate-/l/84.9%
associate-*l/83.6%
*-commutative83.6%
*-commutative83.6%
Simplified83.6%
Final simplification90.3%
(FPCore (x y z) :precision binary64 (if (<= y -6e+158) (+ (/ y (* x z)) (* 0.5 (/ (* y x) z))) (* y (/ (cosh x) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6e+158) {
tmp = (y / (x * z)) + (0.5 * ((y * x) / z));
} 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 <= (-6d+158)) then
tmp = (y / (x * z)) + (0.5d0 * ((y * x) / z))
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 <= -6e+158) {
tmp = (y / (x * z)) + (0.5 * ((y * x) / z));
} else {
tmp = y * (Math.cosh(x) / (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6e+158: tmp = (y / (x * z)) + (0.5 * ((y * x) / z)) else: tmp = y * (math.cosh(x) / (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6e+158) tmp = Float64(Float64(y / Float64(x * z)) + Float64(0.5 * Float64(Float64(y * x) / z))); 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 <= -6e+158) tmp = (y / (x * z)) + (0.5 * ((y * x) / z)); else tmp = y * (cosh(x) / (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6e+158], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $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 -6 \cdot 10^{+158}:\\
\;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\end{array}
\end{array}
if y < -6e158Initial program 94.0%
associate-*r/90.9%
associate-/l/71.9%
associate-/r*96.7%
Simplified96.7%
Taylor expanded in x around 0 94.1%
if -6e158 < y Initial program 82.3%
associate-*r/94.4%
associate-/l/85.2%
associate-*l/84.6%
*-commutative84.6%
*-commutative84.6%
Simplified84.6%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.4e-58) (not (<= y 5.6e-179))) (+ (/ y (* x z)) (* 0.5 (/ (* y x) z))) (* y (+ (/ 1.0 (* x z)) (* 0.5 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.4e-58) || !(y <= 5.6e-179)) {
tmp = (y / (x * z)) + (0.5 * ((y * x) / z));
} else {
tmp = y * ((1.0 / (x * z)) + (0.5 * (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 <= (-3.4d-58)) .or. (.not. (y <= 5.6d-179))) then
tmp = (y / (x * z)) + (0.5d0 * ((y * x) / z))
else
tmp = y * ((1.0d0 / (x * z)) + (0.5d0 * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.4e-58) || !(y <= 5.6e-179)) {
tmp = (y / (x * z)) + (0.5 * ((y * x) / z));
} else {
tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.4e-58) or not (y <= 5.6e-179): tmp = (y / (x * z)) + (0.5 * ((y * x) / z)) else: tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.4e-58) || !(y <= 5.6e-179)) tmp = Float64(Float64(y / Float64(x * z)) + Float64(0.5 * Float64(Float64(y * x) / z))); else tmp = Float64(y * Float64(Float64(1.0 / Float64(x * z)) + Float64(0.5 * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.4e-58) || ~((y <= 5.6e-179))) tmp = (y / (x * z)) + (0.5 * ((y * x) / z)); else tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.4e-58], N[Not[LessEqual[y, 5.6e-179]], $MachinePrecision]], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-58} \lor \neg \left(y \leq 5.6 \cdot 10^{-179}\right):\\
\;\;\;\;\frac{y}{x \cdot z} + 0.5 \cdot \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{1}{x \cdot z} + 0.5 \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -3.39999999999999973e-58 or 5.6000000000000001e-179 < y Initial program 91.2%
associate-*r/83.8%
associate-/l/81.0%
associate-/r*90.7%
Simplified90.7%
Taylor expanded in x around 0 77.3%
if -3.39999999999999973e-58 < y < 5.6000000000000001e-179Initial program 67.7%
associate-*r/99.8%
associate-/l/81.4%
associate-*l/80.9%
*-commutative80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in x around 0 55.9%
Final simplification70.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (* x z))))
(if (or (<= y -1e-54) (not (<= y 5.6e-179)))
(+ t_0 (* 0.5 (/ (* y x) z)))
(+ t_0 (/ (* y 0.5) (/ z x))))))
double code(double x, double y, double z) {
double t_0 = y / (x * z);
double tmp;
if ((y <= -1e-54) || !(y <= 5.6e-179)) {
tmp = t_0 + (0.5 * ((y * x) / z));
} else {
tmp = t_0 + ((y * 0.5) / (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 = y / (x * z)
if ((y <= (-1d-54)) .or. (.not. (y <= 5.6d-179))) then
tmp = t_0 + (0.5d0 * ((y * x) / z))
else
tmp = t_0 + ((y * 0.5d0) / (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (x * z);
double tmp;
if ((y <= -1e-54) || !(y <= 5.6e-179)) {
tmp = t_0 + (0.5 * ((y * x) / z));
} else {
tmp = t_0 + ((y * 0.5) / (z / x));
}
return tmp;
}
def code(x, y, z): t_0 = y / (x * z) tmp = 0 if (y <= -1e-54) or not (y <= 5.6e-179): tmp = t_0 + (0.5 * ((y * x) / z)) else: tmp = t_0 + ((y * 0.5) / (z / x)) return tmp
function code(x, y, z) t_0 = Float64(y / Float64(x * z)) tmp = 0.0 if ((y <= -1e-54) || !(y <= 5.6e-179)) tmp = Float64(t_0 + Float64(0.5 * Float64(Float64(y * x) / z))); else tmp = Float64(t_0 + Float64(Float64(y * 0.5) / Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (x * z); tmp = 0.0; if ((y <= -1e-54) || ~((y <= 5.6e-179))) tmp = t_0 + (0.5 * ((y * x) / z)); else tmp = t_0 + ((y * 0.5) / (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -1e-54], N[Not[LessEqual[y, 5.6e-179]], $MachinePrecision]], N[(t$95$0 + N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(y * 0.5), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot z}\\
\mathbf{if}\;y \leq -1 \cdot 10^{-54} \lor \neg \left(y \leq 5.6 \cdot 10^{-179}\right):\\
\;\;\;\;t_0 + 0.5 \cdot \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{y \cdot 0.5}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -1e-54 or 5.6000000000000001e-179 < y Initial program 91.2%
associate-*r/83.8%
associate-/l/81.0%
associate-/r*90.7%
Simplified90.7%
Taylor expanded in x around 0 77.3%
if -1e-54 < y < 5.6000000000000001e-179Initial program 67.7%
associate-*r/61.5%
associate-/l/70.3%
associate-/r*70.3%
Simplified70.3%
Taylor expanded in x around 0 41.3%
associate-/l*56.4%
associate-*r/56.4%
*-commutative56.4%
Applied egg-rr56.4%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (<= y -3.05e-128) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z) (* y (+ (/ 1.0 (* x z)) (* 0.5 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.05e-128) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y * ((1.0 / (x * z)) + (0.5 * (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 <= (-3.05d-128)) then
tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z
else
tmp = y * ((1.0d0 / (x * z)) + (0.5d0 * (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.05e-128) {
tmp = (y * ((x * 0.5) + (1.0 / x))) / z;
} else {
tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.05e-128: tmp = (y * ((x * 0.5) + (1.0 / x))) / z else: tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.05e-128) tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z); else tmp = Float64(y * Float64(Float64(1.0 / Float64(x * z)) + Float64(0.5 * Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.05e-128) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; else tmp = y * ((1.0 / (x * z)) + (0.5 * (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.05e-128], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(N[(1.0 / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.05 \cdot 10^{-128}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{1}{x \cdot z} + 0.5 \cdot \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -3.0499999999999999e-128Initial program 94.9%
associate-*r/86.6%
associate-/l/77.4%
associate-/r*90.5%
Simplified90.5%
associate-/l/77.4%
associate-*r/78.4%
associate-*l/78.4%
associate-/r*96.0%
associate-*l/94.9%
Applied egg-rr94.9%
Taylor expanded in x around 0 74.1%
if -3.0499999999999999e-128 < y Initial program 77.1%
associate-*r/94.0%
associate-/l/86.6%
associate-*l/85.8%
*-commutative85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in x around 0 63.2%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.42) (not (<= x 1.4))) (* 0.5 (* x (/ y z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.42) || !(x <= 1.4)) {
tmp = 0.5 * (x * (y / 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 ((x <= (-1.42d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (x * (y / 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 ((x <= -1.42) || !(x <= 1.4)) {
tmp = 0.5 * (x * (y / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.42) or not (x <= 1.4): tmp = 0.5 * (x * (y / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.42) || !(x <= 1.4)) tmp = Float64(0.5 * Float64(x * Float64(y / z))); else tmp = Float64(Float64(y / z) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.42) || ~((x <= 1.4))) tmp = 0.5 * (x * (y / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.42], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.4199999999999999 or 1.3999999999999999 < x Initial program 78.9%
Taylor expanded in x around 0 40.0%
associate-*r*40.0%
Simplified40.0%
Taylor expanded in x around inf 40.6%
div-inv40.6%
*-commutative40.6%
associate-*l*31.1%
div-inv31.1%
Applied egg-rr31.1%
if -1.4199999999999999 < x < 1.3999999999999999Initial program 88.7%
associate-*r/88.7%
associate-/l/92.0%
associate-*l/91.1%
*-commutative91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 89.9%
div-inv90.9%
associate-/r*91.6%
Applied egg-rr91.6%
Final simplification61.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.42) (not (<= x 1.4))) (* 0.5 (* y (/ x z))) (/ (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.42) || !(x <= 1.4)) {
tmp = 0.5 * (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 ((x <= (-1.42d0)) .or. (.not. (x <= 1.4d0))) then
tmp = 0.5d0 * (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 ((x <= -1.42) || !(x <= 1.4)) {
tmp = 0.5 * (y * (x / z));
} else {
tmp = (y / z) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.42) or not (x <= 1.4): tmp = 0.5 * (y * (x / z)) else: tmp = (y / z) / x return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.42) || !(x <= 1.4)) tmp = Float64(0.5 * 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 ((x <= -1.42) || ~((x <= 1.4))) tmp = 0.5 * (y * (x / z)); else tmp = (y / z) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.42], N[Not[LessEqual[x, 1.4]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \lor \neg \left(x \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\end{array}
\end{array}
if x < -1.4199999999999999 or 1.3999999999999999 < x Initial program 78.9%
Taylor expanded in x around 0 40.0%
associate-*r*40.0%
Simplified40.0%
Taylor expanded in x around inf 40.6%
associate-*r/40.7%
Simplified40.7%
if -1.4199999999999999 < x < 1.3999999999999999Initial program 88.7%
associate-*r/88.7%
associate-/l/92.0%
associate-*l/91.1%
*-commutative91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 89.9%
div-inv90.9%
associate-/r*91.6%
Applied egg-rr91.6%
Final simplification66.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.42) (* 0.5 (* y (/ x z))) (if (<= x 1.4) (/ (/ y z) x) (* 0.5 (/ (* y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.42) {
tmp = 0.5 * (y * (x / z));
} else if (x <= 1.4) {
tmp = (y / z) / x;
} 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.42d0)) then
tmp = 0.5d0 * (y * (x / z))
else if (x <= 1.4d0) then
tmp = (y / z) / x
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.42) {
tmp = 0.5 * (y * (x / z));
} else if (x <= 1.4) {
tmp = (y / z) / x;
} else {
tmp = 0.5 * ((y * x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.42: tmp = 0.5 * (y * (x / z)) elif x <= 1.4: tmp = (y / z) / x else: tmp = 0.5 * ((y * x) / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.42) tmp = Float64(0.5 * Float64(y * Float64(x / z))); elseif (x <= 1.4) tmp = Float64(Float64(y / z) / x); else tmp = Float64(0.5 * Float64(Float64(y * x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.42) tmp = 0.5 * (y * (x / z)); elseif (x <= 1.4) tmp = (y / z) / x; else tmp = 0.5 * ((y * x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.42], N[(0.5 * N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(0.5 * N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z}\right)\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{z}\\
\end{array}
\end{array}
if x < -1.4199999999999999Initial program 76.8%
Taylor expanded in x around 0 36.6%
associate-*r*36.6%
Simplified36.6%
Taylor expanded in x around inf 36.6%
associate-*r/41.6%
Simplified41.6%
if -1.4199999999999999 < x < 1.3999999999999999Initial program 88.7%
associate-*r/88.7%
associate-/l/92.0%
associate-*l/91.1%
*-commutative91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 89.9%
div-inv90.9%
associate-/r*91.6%
Applied egg-rr91.6%
if 1.3999999999999999 < x Initial program 80.6%
Taylor expanded in x around 0 42.6%
associate-*r*42.6%
Simplified42.6%
Taylor expanded in x around inf 43.7%
Final simplification67.2%
(FPCore (x y z) :precision binary64 (/ (* y (+ (* x 0.5) (/ 1.0 x))) z))
double code(double x, double y, double z) {
return (y * ((x * 0.5) + (1.0 / 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 * 0.5d0) + (1.0d0 / x))) / z
end function
public static double code(double x, double y, double z) {
return (y * ((x * 0.5) + (1.0 / x))) / z;
}
def code(x, y, z): return (y * ((x * 0.5) + (1.0 / x))) / z
function code(x, y, z) return Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z) end
function tmp = code(x, y, z) tmp = (y * ((x * 0.5) + (1.0 / x))) / z; end
code[x_, y_, z_] := N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z}
\end{array}
Initial program 83.8%
associate-*r/76.8%
associate-/l/77.6%
associate-/r*84.3%
Simplified84.3%
associate-/l/77.6%
associate-*r/83.5%
associate-*l/83.0%
associate-/r*95.5%
associate-*l/94.3%
Applied egg-rr94.3%
Taylor expanded in x around 0 63.9%
Final simplification63.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.9e-47) (not (<= y 2500000000000.0))) (/ y (* x z)) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.9e-47) || !(y <= 2500000000000.0)) {
tmp = 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 ((y <= (-5.9d-47)) .or. (.not. (y <= 2500000000000.0d0))) then
tmp = 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 ((y <= -5.9e-47) || !(y <= 2500000000000.0)) {
tmp = y / (x * z);
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.9e-47) or not (y <= 2500000000000.0): tmp = y / (x * z) else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.9e-47) || !(y <= 2500000000000.0)) tmp = 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 ((y <= -5.9e-47) || ~((y <= 2500000000000.0))) tmp = y / (x * z); else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.9e-47], N[Not[LessEqual[y, 2500000000000.0]], $MachinePrecision]], N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{-47} \lor \neg \left(y \leq 2500000000000\right):\\
\;\;\;\;\frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if y < -5.89999999999999973e-47 or 2.5e12 < y Initial program 89.8%
associate-*r/86.2%
associate-/l/84.9%
associate-/r*96.3%
Simplified96.3%
Taylor expanded in x around 0 54.0%
if -5.89999999999999973e-47 < y < 2.5e12Initial program 76.5%
associate-*r/65.3%
associate-/l/68.8%
associate-/r*69.8%
Simplified69.8%
Taylor expanded in x around 0 39.8%
*-commutative39.8%
associate-/r*48.3%
Simplified48.3%
Final simplification51.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.8e-47) (not (<= y 1.02e-168))) (/ (/ y z) x) (/ (/ y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.8e-47) || !(y <= 1.02e-168)) {
tmp = (y / z) / x;
} 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 ((y <= (-6.8d-47)) .or. (.not. (y <= 1.02d-168))) then
tmp = (y / z) / x
else
tmp = (y / x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.8e-47) || !(y <= 1.02e-168)) {
tmp = (y / z) / x;
} else {
tmp = (y / x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.8e-47) or not (y <= 1.02e-168): tmp = (y / z) / x else: tmp = (y / x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.8e-47) || !(y <= 1.02e-168)) tmp = Float64(Float64(y / z) / x); else tmp = Float64(Float64(y / x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.8e-47) || ~((y <= 1.02e-168))) tmp = (y / z) / x; else tmp = (y / x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.8e-47], N[Not[LessEqual[y, 1.02e-168]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-47} \lor \neg \left(y \leq 1.02 \cdot 10^{-168}\right):\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{z}\\
\end{array}
\end{array}
if y < -6.8000000000000003e-47 or 1.01999999999999999e-168 < y Initial program 90.8%
associate-*r/91.4%
associate-/l/84.8%
associate-*l/84.3%
*-commutative84.3%
*-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 51.9%
div-inv52.4%
associate-/r*61.5%
Applied egg-rr61.5%
if -6.8000000000000003e-47 < y < 1.01999999999999999e-168Initial program 70.9%
associate-*r/62.0%
associate-/l/68.9%
associate-/r*67.8%
Simplified67.8%
Taylor expanded in x around 0 38.8%
*-commutative38.8%
associate-/r*47.4%
Simplified47.4%
Final simplification56.5%
(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 83.8%
associate-*r/76.8%
associate-/l/77.6%
associate-/r*84.3%
Simplified84.3%
Taylor expanded in x around 0 47.6%
Final simplification47.6%
(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 2023192
(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))