(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) z) t)))
(t_2 (fma 1.0 (* y (/ z t)) (* x (- 1.0 (/ z t))))))
(if (<= t_1 -1.5169274143000037e+270)
t_2
(if (<= t_1 3.778364107257837e+282)
(+ (+ x (/ (* y z) t)) (* (* x z) (/ -1.0 t)))
t_2))))double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double t_2 = fma(1.0, (y * (z / t)), (x * (1.0 - (z / t))));
double tmp;
if (t_1 <= -1.5169274143000037e+270) {
tmp = t_2;
} else if (t_1 <= 3.778364107257837e+282) {
tmp = (x + ((y * z) / t)) + ((x * z) * (-1.0 / t));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) t_2 = fma(1.0, Float64(y * Float64(z / t)), Float64(x * Float64(1.0 - Float64(z / t)))) tmp = 0.0 if (t_1 <= -1.5169274143000037e+270) tmp = t_2; elseif (t_1 <= 3.778364107257837e+282) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) + Float64(Float64(x * z) * Float64(-1.0 / t))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 * N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1.5169274143000037e+270], t$95$2, If[LessEqual[t$95$1, 3.778364107257837e+282], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(N[(x * z), $MachinePrecision] * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
t_2 := \mathsf{fma}\left(1, y \cdot \frac{z}{t}, x \cdot \left(1 - \frac{z}{t}\right)\right)\\
\mathbf{if}\;t_1 \leq -1.5169274143000037 \cdot 10^{+270}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 3.778364107257837 \cdot 10^{+282}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) + \left(x \cdot z\right) \cdot \frac{-1}{t}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.2 |
|---|---|
| Target | 2.0 |
| Herbie | 1.0 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -1.5169274143000037e270 or 3.77836410725783722e282 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 38.7
Simplified2.4
Taylor expanded in y around 0 38.7
Applied egg-rr26.0
Applied egg-rr2.4
if -1.5169274143000037e270 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 3.77836410725783722e282Initial program 0.7
Simplified2.0
Taylor expanded in y around 0 0.7
Applied egg-rr0.8
Final simplification1.0
herbie shell --seed 2022150
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))