(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
(FPCore (x y z t a)
:precision binary64
(if (<= y -3.9258428577443835e+52)
(fma (- t z) (/ y (- t a)) x)
(if (<= y 1.0514448438020326e-28)
(fma (* y (- z t)) (/ 1.0 (- a t)) x)
(+ x (/ y (/ (- a t) (- z t)))))))double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.9258428577443835e+52) {
tmp = fma((t - z), (y / (t - a)), x);
} else if (y <= 1.0514448438020326e-28) {
tmp = fma((y * (z - t)), (1.0 / (a - t)), x);
} else {
tmp = x + (y / ((a - t) / (z - t)));
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.9258428577443835e+52) tmp = fma(Float64(t - z), Float64(y / Float64(t - a)), x); elseif (y <= 1.0514448438020326e-28) tmp = fma(Float64(y * Float64(z - t)), Float64(1.0 / Float64(a - t)), x); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.9258428577443835e+52], N[(N[(t - z), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 1.0514448438020326e-28], N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \leq -3.9258428577443835 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{t - a}, x\right)\\
\mathbf{elif}\;y \leq 1.0514448438020326 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(z - t\right), \frac{1}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 1.4 |
|---|---|
| Target | 0.4 |
| Herbie | 1.1 |
if y < -3.92584285774438353e52Initial program 0.7
Simplified3.0
if -3.92584285774438353e52 < y < 1.0514448438020326e-28Initial program 2.1
Applied egg-rr2.2
Applied egg-rr0.7
if 1.0514448438020326e-28 < y Initial program 0.4
Taylor expanded in y around 0 20.6
Simplified0.4
Final simplification1.1
herbie shell --seed 2022153
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))