(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
(FPCore (x y z t)
:precision binary64
(if (<= t -1.7058464213464965e+61)
(+ x (* z (/ 1.0 (/ t (- y x)))))
(if (<= t -9.888058153974043e-263)
(fma (* z (- y x)) (/ 1.0 t) x)
(fma (- y x) (/ z t) 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 (t <= -1.7058464213464965e+61) {
tmp = x + (z * (1.0 / (t / (y - x))));
} else if (t <= -9.888058153974043e-263) {
tmp = fma((z * (y - x)), (1.0 / t), x);
} else {
tmp = fma((y - x), (z / t), 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 (t <= -1.7058464213464965e+61) tmp = Float64(x + Float64(z * Float64(1.0 / Float64(t / Float64(y - x))))); elseif (t <= -9.888058153974043e-263) tmp = fma(Float64(z * Float64(y - x)), Float64(1.0 / t), x); else tmp = fma(Float64(y - x), Float64(z / t), 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[t, -1.7058464213464965e+61], N[(x + N[(z * N[(1.0 / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -9.888058153974043e-263], N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t), $MachinePrecision] + x), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision] + x), $MachinePrecision]]]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;t \leq -1.7058464213464965 \cdot 10^{+61}:\\
\;\;\;\;x + z \cdot \frac{1}{\frac{t}{y - x}}\\
\mathbf{elif}\;t \leq -9.888058153974043 \cdot 10^{-263}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y - x\right), \frac{1}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{t}, 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 | 1.8 |
if t < -1.7058464213464965e61Initial program 1.2
Simplified1.2
Applied fma-udef_binary641.2
Simplified1.3
Applied clear-num_binary641.4
if -1.7058464213464965e61 < t < -9.8880581539740433e-263Initial program 2.9
Simplified2.9
Applied fma-udef_binary642.9
Simplified10.5
Applied div-inv_binary6410.5
Applied associate-*r*_binary641.9
Applied fma-def_binary641.9
if -9.8880581539740433e-263 < t Initial program 2.0
Simplified2.0
Final simplification1.8
herbie shell --seed 2022130
(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))))