\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
t_2 := t_1 + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t_2 \leq -1.2799624956574264 \cdot 10^{+294}:\\
\;\;\;\;t_1 + \frac{\frac{t}{z \cdot 3}}{y}\\
\mathbf{elif}\;t_2 \leq 1.5367392502597684 \cdot 10^{+308}:\\
\;\;\;\;t_1 + \frac{t}{3 \cdot \left(y \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.3333333333333333}{z}, y - \frac{t}{y}, x\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 (- x (/ y (* z 3.0)))) (t_2 (+ t_1 (/ t (* y (* z 3.0))))))
(if (<= t_2 -1.2799624956574264e+294)
(+ t_1 (/ (/ t (* z 3.0)) y))
(if (<= t_2 1.5367392502597684e+308)
(+ t_1 (/ t (* 3.0 (* y z))))
(fma (/ -0.3333333333333333 z) (- y (/ t y)) x)))))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));
double t_2 = t_1 + (t / (y * (z * 3.0)));
double tmp;
if (t_2 <= -1.2799624956574264e+294) {
tmp = t_1 + ((t / (z * 3.0)) / y);
} else if (t_2 <= 1.5367392502597684e+308) {
tmp = t_1 + (t / (3.0 * (y * z)));
} else {
tmp = fma((-0.3333333333333333 / z), (y - (t / y)), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 3.2 |
|---|---|
| Target | 1.7 |
| Herbie | 0.5 |
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -1.2799624956574264e294Initial program 34.0
Applied associate-/r*_binary641.2
if -1.2799624956574264e294 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.5367392502597684e308Initial program 0.5
Taylor expanded in z around 0 0.5
if 1.5367392502597684e308 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 62.9
Simplified0.3
Final simplification0.5
herbie shell --seed 2021352
(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))))