\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{0.3333333333333333}{\frac{z}{\frac{t}{y} - y}}\\
\mathbf{elif}\;t_1 \leq 1.2670046298233474 \cdot 10^{+291}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{z}{0.3333333333333333 \cdot \frac{t}{y} + y \cdot -0.3333333333333333}}\\
\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 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
(if (<= t_1 (- INFINITY))
(+ x (/ 0.3333333333333333 (/ z (- (/ t y) y))))
(if (<= t_1 1.2670046298233474e+291)
t_1
(+
x
(/
1.0
(/
z
(+ (* 0.3333333333333333 (/ t y)) (* y -0.3333333333333333)))))))))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 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (0.3333333333333333 / (z / ((t / y) - y)));
} else if (t_1 <= 1.2670046298233474e+291) {
tmp = t_1;
} else {
tmp = x + (1.0 / (z / ((0.3333333333333333 * (t / y)) + (y * -0.3333333333333333))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 4.0 |
|---|---|
| Target | 1.7 |
| Herbie | 0.8 |
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -inf.0Initial program 64.0
Simplified0.3
Applied fma-udef_binary640.3
Simplified0.3
if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.2670046298233474e291Initial program 0.6
if 1.2670046298233474e291 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 31.7
Simplified4.1
Applied fma-udef_binary644.1
Simplified4.1
Applied clear-num_binary644.2
Simplified4.1
Applied *-un-lft-identity_binary644.1
Applied cancel-sign-sub-inv_binary644.1
Applied distribute-rgt-in_binary644.1
Final simplification0.8
herbie shell --seed 2022020
(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))))