(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z t) x)) (t_2 (+ x (/ (* (- y x) z) t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 9.26477070805321e+301)
(- (+ x (/ (* y z) t)) (/ (* x z) t))
t_1))))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 = fma((y - x), (z / t), x);
double t_2 = x + (((y - x) * z) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 9.26477070805321e+301) {
tmp = (x + ((y * z) / t)) - ((x * z) / t);
} else {
tmp = t_1;
}
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 = fma(Float64(y - x), Float64(z / t), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 9.26477070805321e+301) tmp = Float64(Float64(x + Float64(Float64(y * z) / t)) - Float64(Float64(x * z) / t)); else tmp = t_1; 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[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 9.26477070805321e+301], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 9.26477070805321 \cdot 10^{+301}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) - \frac{x \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.4 |
|---|---|
| Target | 1.9 |
| Herbie | 0.8 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 9.26477070805321052e301 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 61.2
Simplified0.3
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 9.26477070805321052e301Initial program 0.8
Simplified2.1
Taylor expanded in y around 0 0.8
Final simplification0.8
herbie shell --seed 2022131
(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)))