x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\begin{array}{l}
\mathbf{if}\;z \leq -1.8535004913060756 \cdot 10^{+161}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{t \cdot y}{z}\\
\mathbf{elif}\;z \leq -7.081586002361856 \cdot 10^{-216}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - z}{t - x}}{y - z}}\\
\mathbf{elif}\;z \leq 1.9038582755546934 \cdot 10^{+95}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - z}{y - z}}{t - x}}\\
\mathbf{elif}\;z \leq 5.2911909187746226 \cdot 10^{+197}:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{t \cdot y}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.8535004913060756e+161)
(- (+ t (/ (* x y) z)) (/ (* t y) z))
(if (<= z -7.081586002361856e-216)
(+ x (/ 1.0 (/ (/ (- a z) (- t x)) (- y z))))
(if (<= z 1.9038582755546934e+95)
(+ x (/ 1.0 (/ (/ (- a z) (- y z)) (- t x))))
(if (<= z 5.2911909187746226e+197)
(-
(+ t (+ (/ (* x y) z) (/ (* t a) z)))
(+ (/ (* t y) z) (/ (* x a) z)))
(* t (/ (- y z) (- a z))))))))double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8535004913060756e+161) {
tmp = (t + ((x * y) / z)) - ((t * y) / z);
} else if (z <= -7.081586002361856e-216) {
tmp = x + (1.0 / (((a - z) / (t - x)) / (y - z)));
} else if (z <= 1.9038582755546934e+95) {
tmp = x + (1.0 / (((a - z) / (y - z)) / (t - x)));
} else if (z <= 5.2911909187746226e+197) {
tmp = (t + (((x * y) / z) + ((t * a) / z))) - (((t * y) / z) + ((x * a) / z));
} else {
tmp = t * ((y - z) / (a - z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.4 |
|---|---|
| Target | 11.2 |
| Herbie | 12.3 |
if z < -1.8535004913060756e161Initial program 47.8
Taylor expanded around 0 24.2
if -1.8535004913060756e161 < z < -7.0815860023618558e-216Initial program 17.3
rmApplied associate-/l*_binary64_163919.6
rmApplied clear-num_binary64_164459.6
if -7.0815860023618558e-216 < z < 1.903858275554693e95Initial program 11.4
rmApplied add-cube-cbrt_binary64_1648111.9
Applied associate-/r*_binary64_1639011.9
Simplified7.0
rmApplied clear-num_binary64_164457.0
Simplified5.4
if 1.903858275554693e95 < z < 5.2911909187746226e197Initial program 37.5
Taylor expanded around inf 23.7
Simplified23.7
if 5.2911909187746226e197 < z Initial program 50.9
Taylor expanded around inf 19.6
Simplified19.6
Final simplification12.3
herbie shell --seed 2021044
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:herbie-target
(if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))
(+ x (/ (* (- y z) (- t x)) (- a z))))