x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\begin{array}{l}
\mathbf{if}\;t \le -2.54383536088708091 \cdot 10^{233}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\
\mathbf{elif}\;t \le 4.80918778606114512 \cdot 10^{-143}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{a - t}{y - x}} - \left(\frac{t}{\frac{a - t}{y - x}} - x\right)\\
\end{array}double code(double x, double y, double z, double t, double a) {
return (x + (((y - x) * (z - t)) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
double VAR;
if ((t <= -2.543835360887081e+233)) {
VAR = fma((x / t), z, (y - ((z * y) / t)));
} else {
double VAR_1;
if ((t <= 4.809187786061145e-143)) {
VAR_1 = fma(((z - t) / (a - t)), (y - x), x);
} else {
VAR_1 = ((z / ((a - t) / (y - x))) - ((t / ((a - t) / (y - x))) - x));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.0 |
|---|---|
| Target | 9.4 |
| Herbie | 10.9 |
if t < -2.543835360887081e+233Initial program 51.4
Simplified34.7
rmApplied clear-num35.0
rmApplied fma-udef35.1
Simplified35.1
Taylor expanded around inf 22.6
Simplified18.0
if -2.543835360887081e+233 < t < 4.809187786061145e-143Initial program 17.1
Simplified10.8
rmApplied clear-num11.1
rmApplied fma-udef11.1
Simplified10.8
rmApplied associate-/r/7.7
Applied fma-def7.7
if 4.809187786061145e-143 < t Initial program 28.8
Simplified16.9
rmApplied clear-num17.2
rmApplied fma-udef17.3
Simplified17.1
rmApplied div-sub17.1
Applied associate-+l-14.1
Final simplification10.9
herbie shell --seed 2020079 +o rules:numerics
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))