x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\begin{array}{l}
\mathbf{if}\;a \leq -5.284160521582155 \cdot 10^{-116}:\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\
\mathbf{elif}\;a \leq 1.5807917828594455 \cdot 10^{-115}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{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 (<= a -5.284160521582155e-116)
(+ x (* (/ (- y z) (- a z)) (- t x)))
(if (<= a 1.5807917828594455e-115)
(- (+ t (/ (* x y) z)) (/ (* y t) z))
(+
x
(*
(/ (- y z) (* (cbrt (- a z)) (cbrt (- a z))))
(/ (- t x) (cbrt (- 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 (a <= -5.284160521582155e-116) {
tmp = x + (((y - z) / (a - z)) * (t - x));
} else if (a <= 1.5807917828594455e-115) {
tmp = (t + ((x * y) / z)) - ((y * t) / z);
} else {
tmp = x + (((y - z) / (cbrt(a - z) * cbrt(a - z))) * ((t - x) / cbrt(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 | 25.3 |
|---|---|
| Target | 12.1 |
| Herbie | 11.0 |
if a < -5.28416052158215461e-116Initial program 23.0
rmApplied associate-/l*_binary6411.4
rmApplied associate-/r/_binary648.9
if -5.28416052158215461e-116 < a < 1.5807917828594455e-115Initial program 29.8
rmApplied associate-/l*_binary6424.9
Taylor expanded around inf 15.6
Simplified15.6
if 1.5807917828594455e-115 < a Initial program 24.1
rmApplied add-cube-cbrt_binary6424.5
Applied times-frac_binary649.6
Final simplification11.0
herbie shell --seed 2020273
(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))))