x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -1.2104065643874172 \cdot 10^{-306} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a \cdot \left(x \cdot y\right)}{z \cdot z} + \left(\frac{t \cdot a}{z} + \left(t + \frac{x \cdot y}{z}\right)\right)\right) - \left(\frac{x \cdot a}{z} + \left(\frac{y \cdot \left(t \cdot a\right)}{z \cdot z} + \frac{y \cdot t}{z}\right)\right)\\
\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 (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -1.2104065643874172e-306)
(not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
(+ x (* (- t x) (/ (- y z) (- a z))))
(-
(+ (/ (* a (* x y)) (* z z)) (+ (/ (* t a) z) (+ t (/ (* x y) z))))
(+ (/ (* x a) z) (+ (/ (* y (* t a)) (* z z)) (/ (* y t) 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 (((x + (((y - z) * (t - x)) / (a - z))) <= -1.2104065643874172e-306) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
tmp = x + ((t - x) * ((y - z) / (a - z)));
} else {
tmp = (((a * (x * y)) / (z * z)) + (((t * a) / z) + (t + ((x * y) / z)))) - (((x * a) / z) + (((y * (t * a)) / (z * z)) + ((y * t) / 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.0 |
|---|---|
| Target | 12.3 |
| Herbie | 6.7 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.21040656438741722e-306 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 21.6
rmApplied add-cube-cbrt_binary64_1409422.1
Applied times-frac_binary64_140658.4
rmApplied add-cube-cbrt_binary64_140948.6
Applied *-un-lft-identity_binary64_140598.6
Applied times-frac_binary64_140658.6
Applied associate-*r*_binary64_139998.1
Simplified8.1
rmApplied pow1_binary64_141208.1
Applied pow1_binary64_141208.1
Applied pow-prod-down_binary64_141308.1
Simplified8.2
rmApplied *-un-lft-identity_binary64_140598.2
Applied *-un-lft-identity_binary64_140598.2
Applied distribute-lft-out_binary64_140108.2
Simplified7.2
if -1.21040656438741722e-306 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 61.1
Taylor expanded around 0 1.8
Simplified1.8
Final simplification6.7
herbie shell --seed 2020344
(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))))