\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\begin{array}{l}
\mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq -\infty:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{\frac{z}{-0.3333333333333333}}\\
\mathbf{elif}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq 1.876860962824293 \cdot 10^{+201}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{\frac{1}{z}}{-3}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
:precision binary64
(if (<= (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0)))) (- INFINITY))
(+ x (/ (- y (/ t y)) (/ z -0.3333333333333333)))
(if (<=
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
1.876860962824293e+201)
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
(+ x (* (- y (/ t y)) (/ (/ 1.0 z) -3.0))))))double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
double tmp;
if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= -((double) INFINITY)) {
tmp = x + ((y - (t / y)) / (z / -0.3333333333333333));
} else if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= 1.876860962824293e+201) {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
} else {
tmp = x + ((y - (t / y)) * ((1.0 / z) / -3.0));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.6 |
|---|---|
| Target | 1.7 |
| Herbie | 1.2 |
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -inf.0Initial program 64.0
Simplified0.4
rmApplied clear-num_binary64_195140.4
rmApplied associate-*l/_binary64_194580.4
if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.87686096282429308e201Initial program 0.5
if 1.87686096282429308e201 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 8.2
Simplified4.3
rmApplied clear-num_binary64_195144.4
rmApplied div-inv_binary64_195124.3
Applied associate-/r*_binary64_194594.3
Final simplification1.2
herbie shell --seed 2021043
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))