(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cosh x) (/ y x))))
(if (<= t_0 -1e+219)
(* y (/ (cosh x) (* x z)))
(if (<= t_0 2e+276)
(/ t_0 z)
(+
(/ y (* x z))
(*
(/ y z)
(+
(fma
0.041666666666666664
(pow x 3.0)
(* 0.001388888888888889 (pow x 5.0)))
(* x 0.5))))))))double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
double code(double x, double y, double z) {
double t_0 = cosh(x) * (y / x);
double tmp;
if (t_0 <= -1e+219) {
tmp = y * (cosh(x) / (x * z));
} else if (t_0 <= 2e+276) {
tmp = t_0 / z;
} else {
tmp = (y / (x * z)) + ((y / z) * (fma(0.041666666666666664, pow(x, 3.0), (0.001388888888888889 * pow(x, 5.0))) + (x * 0.5)));
}
return tmp;
}
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function code(x, y, z) t_0 = Float64(cosh(x) * Float64(y / x)) tmp = 0.0 if (t_0 <= -1e+219) tmp = Float64(y * Float64(cosh(x) / Float64(x * z))); elseif (t_0 <= 2e+276) tmp = Float64(t_0 / z); else tmp = Float64(Float64(y / Float64(x * z)) + Float64(Float64(y / z) * Float64(fma(0.041666666666666664, (x ^ 3.0), Float64(0.001388888888888889 * (x ^ 5.0))) + Float64(x * 0.5)))); end return tmp end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+219], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+276], N[(t$95$0 / z), $MachinePrecision], N[(N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision] + N[(N[(y / z), $MachinePrecision] * N[(N[(0.041666666666666664 * N[Power[x, 3.0], $MachinePrecision] + N[(0.001388888888888889 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+219}:\\
\;\;\;\;y \cdot \frac{\cosh x}{x \cdot z}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x \cdot z} + \frac{y}{z} \cdot \left(\mathsf{fma}\left(0.041666666666666664, {x}^{3}, 0.001388888888888889 \cdot {x}^{5}\right) + x \cdot 0.5\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.4 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -9.99999999999999965e218Initial program 31.3
Applied egg-rr28.2
Applied egg-rr28.2
Applied egg-rr0.7
if -9.99999999999999965e218 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 2.0000000000000001e276Initial program 0.2
Applied egg-rr0.6
Applied egg-rr0.4
Applied egg-rr0.2
if 2.0000000000000001e276 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 48.0
Taylor expanded in x around 0 1.0
Simplified0.9
Final simplification0.4
herbie shell --seed 2022166
(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))