(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cosh x) (/ y x)))
(t_1
(/
(*
y
(+
(fma x (* x 0.5) (* 0.001388888888888889 (pow x 6.0)))
(+ (* 0.041666666666666664 (pow x 4.0)) 1.0)))
(* x z))))
(if (<= t_0 -1.3453778045793706e+264)
t_1
(if (<= t_0 1.5168936677776953e+199) (/ t_0 z) t_1))))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 t_1 = (y * (fma(x, (x * 0.5), (0.001388888888888889 * pow(x, 6.0))) + ((0.041666666666666664 * pow(x, 4.0)) + 1.0))) / (x * z);
double tmp;
if (t_0 <= -1.3453778045793706e+264) {
tmp = t_1;
} else if (t_0 <= 1.5168936677776953e+199) {
tmp = t_0 / z;
} else {
tmp = t_1;
}
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)) t_1 = Float64(Float64(y * Float64(fma(x, Float64(x * 0.5), Float64(0.001388888888888889 * (x ^ 6.0))) + Float64(Float64(0.041666666666666664 * (x ^ 4.0)) + 1.0))) / Float64(x * z)) tmp = 0.0 if (t_0 <= -1.3453778045793706e+264) tmp = t_1; elseif (t_0 <= 1.5168936677776953e+199) tmp = Float64(t_0 / z); else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(y * N[(N[(x * N[(x * 0.5), $MachinePrecision] + N[(0.001388888888888889 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1.3453778045793706e+264], t$95$1, If[LessEqual[t$95$0, 1.5168936677776953e+199], N[(t$95$0 / z), $MachinePrecision], t$95$1]]]]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
t_0 := \cosh x \cdot \frac{y}{x}\\
t_1 := \frac{y \cdot \left(\mathsf{fma}\left(x, x \cdot 0.5, 0.001388888888888889 \cdot {x}^{6}\right) + \left(0.041666666666666664 \cdot {x}^{4} + 1\right)\right)}{x \cdot z}\\
\mathbf{if}\;t_0 \leq -1.3453778045793706 \cdot 10^{+264}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 1.5168936677776953 \cdot 10^{+199}:\\
\;\;\;\;\frac{t_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -1.3453778045793706e264 or 1.51689366777769529e199 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 33.6
Simplified1.4
Applied egg-rr1.1
Applied egg-rr1.3
Taylor expanded in x around 0 1.6
Simplified1.6
Taylor expanded in z around 0 1.4
Simplified1.4
if -1.3453778045793706e264 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 1.51689366777769529e199Initial program 0.3
Final simplification0.5
herbie shell --seed 2022150
(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))