(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
(FPCore (x y z t) :precision binary64 (if (<= x -1e-26) (fma (/ z t) (- y x) x) (if (<= x 1e-130) (+ x (/ (* z (- y x)) t)) (+ x (* (/ z t) (- y x))))))
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 tmp;
if (x <= -1e-26) {
tmp = fma((z / t), (y - x), x);
} else if (x <= 1e-130) {
tmp = x + ((z * (y - x)) / t);
} else {
tmp = x + ((z / t) * (y - x));
}
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) tmp = 0.0 if (x <= -1e-26) tmp = fma(Float64(z / t), Float64(y - x), x); elseif (x <= 1e-130) tmp = Float64(x + Float64(Float64(z * Float64(y - x)) / t)); else tmp = Float64(x + Float64(Float64(z / t) * Float64(y - x))); 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_] := If[LessEqual[x, -1e-26], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 1e-130], N[(x + N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)\\
\mathbf{elif}\;x \leq 10^{-130}:\\
\;\;\;\;x + \frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\
\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 | 2.1 |
if x < -1e-26Initial program 0.1
Applied egg-rr0.1
if -1e-26 < x < 1.0000000000000001e-130Initial program 4.4
Applied egg-rr5.0
Applied egg-rr4.5
if 1.0000000000000001e-130 < x Initial program 0.6
Final simplification2.1
herbie shell --seed 2022166
(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))))