\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := -0.3333333333333333 \cdot \frac{y}{z} + x\\
t_2 := \frac{-0.3333333333333333 \cdot \frac{t}{z}}{-y}\\
\mathbf{if}\;z \cdot 3 \leq -4.5958281934156114 \cdot 10^{+148}:\\
\;\;\;\;t_1 + t_2\\
\mathbf{elif}\;z \cdot 3 \leq 1.3458777268875003 \cdot 10^{-66}:\\
\;\;\;\;t_1 + \frac{0.3333333333333333 \cdot \frac{t}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(x + \frac{-0.3333333333333333 \cdot y}{z}\right)\\
\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
(let* ((t_1 (+ (* -0.3333333333333333 (/ y z)) x))
(t_2 (/ (* -0.3333333333333333 (/ t z)) (- y))))
(if (<= (* z 3.0) -4.5958281934156114e+148)
(+ t_1 t_2)
(if (<= (* z 3.0) 1.3458777268875003e-66)
(+ t_1 (/ (* 0.3333333333333333 (/ t y)) z))
(+ t_2 (+ x (/ (* -0.3333333333333333 y) z)))))))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 t_1 = (-0.3333333333333333 * (y / z)) + x;
double t_2 = (-0.3333333333333333 * (t / z)) / -y;
double tmp;
if ((z * 3.0) <= -4.5958281934156114e+148) {
tmp = t_1 + t_2;
} else if ((z * 3.0) <= 1.3458777268875003e-66) {
tmp = t_1 + ((0.3333333333333333 * (t / y)) / z);
} else {
tmp = t_2 + (x + ((-0.3333333333333333 * y) / z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.8 |
|---|---|
| Target | 1.8 |
| Herbie | 1.5 |
if (*.f64 z 3) < -4.5958281934156114e148Initial program 0.6
Simplified7.8
rmApplied div-inv_binary647.8
Applied cancel-sign-sub-inv_binary647.8
Applied distribute-rgt-in_binary647.8
Applied associate-+r+_binary647.8
Simplified7.8
rmApplied un-div-inv_binary647.8
Applied associate-*l/_binary641.3
Simplified1.3
rmApplied frac-2neg_binary641.3
Simplified1.3
if -4.5958281934156114e148 < (*.f64 z 3) < 1.34587772688750032e-66Initial program 8.2
Simplified1.7
rmApplied div-inv_binary641.7
Applied cancel-sign-sub-inv_binary641.7
Applied distribute-rgt-in_binary641.7
Applied associate-+r+_binary641.7
Simplified1.8
rmApplied associate-*r/_binary641.7
Simplified1.7
if 1.34587772688750032e-66 < (*.f64 z 3) Initial program 0.5
Simplified5.2
rmApplied div-inv_binary645.2
Applied cancel-sign-sub-inv_binary645.2
Applied distribute-rgt-in_binary645.2
Applied associate-+r+_binary645.2
Simplified5.2
rmApplied un-div-inv_binary645.2
Applied associate-*l/_binary641.3
Simplified1.3
rmApplied frac-2neg_binary641.3
Simplified1.3
rmApplied associate-*r/_binary641.3
Simplified1.3
Final simplification1.5
herbie shell --seed 2021204
(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))))