\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq -5.92276022538686 \cdot 10^{-274}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{z - t}{a - t}\right)\\
\mathbf{elif}\;\left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t} \leq 5.894528428619599 \cdot 10^{-299}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \frac{z - t}{\frac{a - t}{y}}\right)\\
\end{array}(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
:precision binary64
(if (<= (- (+ x y) (/ (* y (- z t)) (- a t))) -5.92276022538686e-274)
(+ x (* y (- 1.0 (/ (- z t) (- a t)))))
(if (<= (- (+ x y) (/ (* y (- z t)) (- a t))) 5.894528428619599e-299)
(+ x (* y (/ z t)))
(+ x (- y (/ (- z t) (/ (- a t) y)))))))double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x + y) - ((y * (z - t)) / (a - t))) <= -5.92276022538686e-274) {
tmp = x + (y * (1.0 - ((z - t) / (a - t))));
} else if (((x + y) - ((y * (z - t)) / (a - t))) <= 5.894528428619599e-299) {
tmp = x + (y * (z / t));
} else {
tmp = x + (y - ((z - t) / ((a - t) / y)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 16.7 |
|---|---|
| Target | 8.3 |
| Herbie | 6.1 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -5.9227602253868597e-274Initial program 12.9
rmApplied associate-/l*_binary64_177557.6
rmApplied associate--l+_binary64_177475.8
rmApplied associate-/r/_binary64_177564.9
Applied *-un-lft-identity_binary64_178104.9
Applied distribute-rgt-out--_binary64_177644.9
if -5.9227602253868597e-274 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 5.8945284286195986e-299Initial program 60.3
rmApplied associate-/l*_binary64_1775560.9
rmApplied associate--l+_binary64_1774744.2
rmApplied associate-/r/_binary64_1775633.4
Applied *-un-lft-identity_binary64_1781033.4
Applied distribute-rgt-out--_binary64_1776433.4
Taylor expanded around inf 16.3
if 5.8945284286195986e-299 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 12.5
rmApplied associate-/l*_binary64_177557.4
rmApplied associate--l+_binary64_177475.5
Final simplification6.1
herbie shell --seed 2020342
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-07) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))