x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
\mathbf{if}\;z \leq -3.855894969108078 \cdot 10^{+108} \lor \neg \left(z \leq 5.023950248753564 \cdot 10^{+141}\right):\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\end{array}(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.855894969108078e+108) (not (<= z 5.023950248753564e+141))) (- (* x x) (* z (* z (* y 4.0)))) (+ (* x x) (* (* y 4.0) (- t (* z z))))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.855894969108078e+108) || !(z <= 5.023950248753564e+141)) {
tmp = (x * x) - (z * (z * (y * 4.0)));
} else {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 5.9 |
|---|---|
| Target | 5.8 |
| Herbie | 0.3 |
if z < -3.8558949691080778e108 or 5.0239502487535643e141 < z Initial program 45.2
Taylor expanded around inf 46.3
Simplified1.3
if -3.8558949691080778e108 < z < 5.0239502487535643e141Initial program 0.1
Final simplification0.3
herbie shell --seed 2021176
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))