\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 -3.152584455246644 \cdot 10^{+305}:\\
\;\;\;\;x + -0.3333333333333333 \cdot \frac{y - \frac{t}{y}}{z}\\
\mathbf{elif}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq 1.7119330914986298 \cdot 10^{+305}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{0.3333333333333333}{\frac{z}{t} \cdot \left(y + \frac{{y}^{3}}{t}\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
(if (<=
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
-3.152584455246644e+305)
(+ x (* -0.3333333333333333 (/ (- y (/ t y)) z)))
(if (<=
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
1.7119330914986298e+305)
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
(+ x (/ 0.3333333333333333 (* (/ z t) (+ y (/ (pow y 3.0) t))))))))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)))) <= -3.152584455246644e+305) {
tmp = x + (-0.3333333333333333 * ((y - (t / y)) / z));
} else if (((x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))) <= 1.7119330914986298e+305) {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
} else {
tmp = x + (0.3333333333333333 / ((z / t) * (y + (pow(y, 3.0) / t))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.4 |
|---|---|
| Target | 1.6 |
| Herbie | 0.8 |
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -3.15258445524664416e305Initial program 55.0
Simplified1.3
Taylor expanded around 0 2.2
if -3.15258445524664416e305 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.71193309149862979e305Initial program 0.5
if 1.71193309149862979e305 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 52.1
Simplified1.2
rmApplied pow1_binary641.2
Applied pow1_binary641.2
Applied pow-prod-down_binary641.2
Simplified1.6
rmApplied div-inv_binary641.6
Applied associate-*r*_binary641.2
Simplified1.2
Taylor expanded around 0 1.6
Simplified1.2
Taylor expanded around inf 58.8
Simplified10.0
Final simplification0.8
herbie shell --seed 2021118
(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))))