(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)))
(if (<= t -3.0549464306960693e+114)
t_1
(if (<= t 1.9957900418829807e-39)
(- (+ 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 tmp;
if (t <= -3.0549464306960693e+114) {
tmp = t_1;
} else if (t <= 1.9957900418829807e-39) {
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(y - x) * Float64(z / t))) end
function code(x, y, z, t) t_1 = fma(Float64(y - x), Float64(z / t), x) tmp = 0.0 if (t <= -3.0549464306960693e+114) tmp = t_1; elseif (t <= 1.9957900418829807e-39) 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[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.0549464306960693e+114], t$95$1, If[LessEqual[t, 1.9957900418829807e-39], N[(N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] - N[(N[(x * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{if}\;t \leq -3.0549464306960693 \cdot 10^{+114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.9957900418829807 \cdot 10^{-39}:\\
\;\;\;\;\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 | 2.0 |
|---|---|
| Target | 2.2 |
| Herbie | 1.8 |
if t < -3.0549464306960693e114 or 1.99579004188298071e-39 < t Initial program 1.1
Simplified1.1
if -3.0549464306960693e114 < t < 1.99579004188298071e-39Initial program 3.1
Simplified3.1
Taylor expanded in y around 0 2.8
Final simplification1.8
herbie shell --seed 2022131
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))