
(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 11 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 (/ y (* x (/ z (cosh x)))))
double code(double x, double y, double z) {
return y / (x * (z / cosh(x)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (x * (z / cosh(x)))
end function
public static double code(double x, double y, double z) {
return y / (x * (z / Math.cosh(x)));
}
def code(x, y, z): return y / (x * (z / math.cosh(x)))
function code(x, y, z) return Float64(y / Float64(x * Float64(z / cosh(x)))) end
function tmp = code(x, y, z) tmp = y / (x * (z / cosh(x))); end
code[x_, y_, z_] := N[(y / N[(x * N[(z / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x \cdot \frac{z}{\cosh x}}
\end{array}
Initial program 86.1%
associate-*l/86.0%
Simplified86.0%
clear-num86.0%
frac-times98.4%
*-un-lft-identity98.4%
Applied egg-rr98.4%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= x 4e-39) (/ y (* z x)) (* (/ (cosh x) z) (/ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4e-39) {
tmp = y / (z * x);
} else {
tmp = (cosh(x) / z) * (y / x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4d-39) then
tmp = y / (z * x)
else
tmp = (cosh(x) / z) * (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4e-39) {
tmp = y / (z * x);
} else {
tmp = (Math.cosh(x) / z) * (y / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4e-39: tmp = y / (z * x) else: tmp = (math.cosh(x) / z) * (y / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4e-39) tmp = Float64(y / Float64(z * x)); else tmp = Float64(Float64(cosh(x) / z) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4e-39) tmp = y / (z * x); else tmp = (cosh(x) / z) * (y / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4e-39], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{z} \cdot \frac{y}{x}\\
\end{array}
\end{array}
if x < 3.99999999999999972e-39Initial program 91.2%
associate-*l/91.1%
Simplified91.1%
Taylor expanded in x around 0 70.0%
if 3.99999999999999972e-39 < x Initial program 74.6%
associate-*l/74.7%
Simplified74.7%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (* y (/ (/ (cosh x) x) z)))
double code(double x, double y, double z) {
return y * ((cosh(x) / 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 * ((cosh(x) / x) / z)
end function
public static double code(double x, double y, double z) {
return y * ((Math.cosh(x) / x) / z);
}
def code(x, y, z): return y * ((math.cosh(x) / x) / z)
function code(x, y, z) return Float64(y * Float64(Float64(cosh(x) / x) / z)) end
function tmp = code(x, y, z) tmp = y * ((cosh(x) / x) / z); end
code[x_, y_, z_] := N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{\frac{\cosh x}{x}}{z}
\end{array}
Initial program 86.1%
associate-*l/86.0%
Simplified86.0%
clear-num86.0%
frac-times98.4%
*-un-lft-identity98.4%
Applied egg-rr98.4%
associate-*l/92.2%
associate-/l*98.4%
associate-/l*96.2%
*-commutative96.2%
associate-/l*90.4%
associate-/r/98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (* y (+ (* 0.5 (/ x z)) (/ 1.0 (* z x)))))
double code(double x, double y, double z) {
return y * ((0.5 * (x / z)) + (1.0 / (z * x)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((0.5d0 * (x / z)) + (1.0d0 / (z * x)))
end function
public static double code(double x, double y, double z) {
return y * ((0.5 * (x / z)) + (1.0 / (z * x)));
}
def code(x, y, z): return y * ((0.5 * (x / z)) + (1.0 / (z * x)))
function code(x, y, z) return Float64(y * Float64(Float64(0.5 * Float64(x / z)) + Float64(1.0 / Float64(z * x)))) end
function tmp = code(x, y, z) tmp = y * ((0.5 * (x / z)) + (1.0 / (z * x))); end
code[x_, y_, z_] := N[(y * N[(N[(0.5 * N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(0.5 \cdot \frac{x}{z} + \frac{1}{z \cdot x}\right)
\end{array}
Initial program 86.1%
associate-*l/86.0%
Simplified86.0%
clear-num86.0%
frac-times98.4%
*-un-lft-identity98.4%
Applied egg-rr98.4%
associate-*l/92.2%
associate-/l*98.4%
associate-/l*96.2%
*-commutative96.2%
associate-/l*90.4%
associate-/r/98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 71.7%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ y (* z x)) (* 0.5 (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = 0.5 * (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 (x <= 1.4d0) then
tmp = y / (z * x)
else
tmp = 0.5d0 * (x / (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = 0.5 * (x / (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = y / (z * x) else: tmp = 0.5 * (x / (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(y / Float64(z * x)); else tmp = Float64(0.5 * Float64(x / Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = y / (z * x); else tmp = 0.5 * (x / (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 91.7%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in x around 0 71.8%
if 1.3999999999999999 < x Initial program 70.6%
Taylor expanded in x around 0 37.0%
Taylor expanded in x around inf 37.0%
associate-/l*31.5%
Simplified31.5%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ y (* z x)) (* x (* y (/ 0.5 z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = x * (y * (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 <= 1.4d0) then
tmp = y / (z * x)
else
tmp = x * (y * (0.5d0 / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = x * (y * (0.5 / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = y / (z * x) else: tmp = x * (y * (0.5 / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(y / Float64(z * x)); else tmp = Float64(x * Float64(y * Float64(0.5 / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = y / (z * x); else tmp = x * (y * (0.5 / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{z}\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 91.7%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in x around 0 71.8%
if 1.3999999999999999 < x Initial program 70.6%
Taylor expanded in x around 0 37.0%
Taylor expanded in x around inf 37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l/37.0%
associate-/l*37.0%
Simplified37.0%
div-inv37.0%
clear-num37.0%
*-commutative37.0%
associate-*l*31.5%
Applied egg-rr31.5%
Final simplification61.1%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ y (* z x)) (* (/ 0.5 z) (* y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = (0.5 / z) * (y * x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = y / (z * x)
else
tmp = (0.5d0 / z) * (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} else {
tmp = (0.5 / z) * (y * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = y / (z * x) else: tmp = (0.5 / z) * (y * x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(y / Float64(z * x)); else tmp = Float64(Float64(0.5 / z) * Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = y / (z * x); else tmp = (0.5 / z) * (y * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{z} \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 91.7%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in x around 0 71.8%
if 1.3999999999999999 < x Initial program 70.6%
Taylor expanded in x around 0 37.0%
Taylor expanded in x around inf 37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l/37.0%
associate-/l*37.0%
Simplified37.0%
clear-num37.0%
associate-/r/37.0%
clear-num37.0%
*-commutative37.0%
Applied egg-rr37.0%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (if (<= x 1.4) (/ y (* z x)) (* y (/ (* x 0.5) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4) {
tmp = y / (z * x);
} 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 <= 1.4d0) then
tmp = y / (z * x)
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 <= 1.4) {
tmp = y / (z * x);
} else {
tmp = y * ((x * 0.5) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4: tmp = y / (z * x) else: tmp = y * ((x * 0.5) / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(y / Float64(z * x)); else tmp = Float64(y * Float64(Float64(x * 0.5) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.4) tmp = y / (z * x); else tmp = y * ((x * 0.5) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x * 0.5), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 91.7%
associate-*l/91.6%
Simplified91.6%
Taylor expanded in x around 0 71.8%
if 1.3999999999999999 < x Initial program 70.6%
Taylor expanded in x around 0 37.0%
Taylor expanded in x around inf 37.0%
*-commutative37.0%
*-commutative37.0%
associate-*l/37.0%
associate-/l*37.0%
Simplified37.0%
associate-/r/37.0%
*-commutative37.0%
associate-*l/42.6%
associate-/r/31.5%
*-commutative31.5%
associate-*r/31.5%
associate-/r/42.6%
*-commutative42.6%
Applied egg-rr42.6%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (/ (- y) (/ z (- (* x -0.5) (/ 1.0 x)))))
double code(double x, double y, double z) {
return -y / (z / ((x * -0.5) - (1.0 / x)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -y / (z / ((x * (-0.5d0)) - (1.0d0 / x)))
end function
public static double code(double x, double y, double z) {
return -y / (z / ((x * -0.5) - (1.0 / x)));
}
def code(x, y, z): return -y / (z / ((x * -0.5) - (1.0 / x)))
function code(x, y, z) return Float64(Float64(-y) / Float64(z / Float64(Float64(x * -0.5) - Float64(1.0 / x)))) end
function tmp = code(x, y, z) tmp = -y / (z / ((x * -0.5) - (1.0 / x))); end
code[x_, y_, z_] := N[((-y) / N[(z / N[(N[(x * -0.5), $MachinePrecision] - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-y}{\frac{z}{x \cdot -0.5 - \frac{1}{x}}}
\end{array}
Initial program 86.1%
associate-*l/86.0%
Simplified86.0%
clear-num86.0%
frac-times98.4%
*-un-lft-identity98.4%
Applied egg-rr98.4%
associate-*l/92.2%
associate-/l*98.4%
associate-/l*96.2%
*-commutative96.2%
associate-/l*90.4%
associate-/r/98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 71.7%
Taylor expanded in z around -inf 67.3%
mul-1-neg67.3%
associate-/l*70.6%
*-commutative70.6%
Simplified70.6%
Final simplification70.6%
(FPCore (x y z) :precision binary64 (if (<= z 3.8e-80) (/ (/ y z) x) (/ y (* z x))))
double code(double x, double y, double z) {
double tmp;
if (z <= 3.8e-80) {
tmp = (y / z) / x;
} 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 <= 3.8d-80) then
tmp = (y / z) / x
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 <= 3.8e-80) {
tmp = (y / z) / x;
} else {
tmp = y / (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 3.8e-80: tmp = (y / z) / x else: tmp = y / (z * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 3.8e-80) tmp = Float64(Float64(y / z) / x); else tmp = Float64(y / Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 3.8e-80) tmp = (y / z) / x; else tmp = y / (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 3.8e-80], N[(N[(y / z), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.8 \cdot 10^{-80}:\\
\;\;\;\;\frac{\frac{y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot x}\\
\end{array}
\end{array}
if z < 3.79999999999999967e-80Initial program 86.3%
associate-*l/86.3%
Simplified86.3%
Taylor expanded in x around 0 52.3%
clear-num52.3%
associate-/r/52.3%
*-commutative52.3%
Applied egg-rr52.3%
associate-*l/52.3%
*-un-lft-identity52.3%
associate-/r*55.4%
Applied egg-rr55.4%
if 3.79999999999999967e-80 < z Initial program 85.4%
associate-*l/85.3%
Simplified85.3%
Taylor expanded in x around 0 61.5%
Final simplification57.2%
(FPCore (x y z) :precision binary64 (/ y (* z x)))
double code(double x, double y, double z) {
return y / (z * x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (z * x)
end function
public static double code(double x, double y, double z) {
return y / (z * x);
}
def code(x, y, z): return y / (z * x)
function code(x, y, z) return Float64(y / Float64(z * x)) end
function tmp = code(x, y, z) tmp = y / (z * x); end
code[x_, y_, z_] := N[(y / N[(z * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z \cdot x}
\end{array}
Initial program 86.1%
associate-*l/86.0%
Simplified86.0%
Taylor expanded in x around 0 55.0%
Final simplification55.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 2024024
(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))