x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
\mathbf{if}\;z \cdot z \le 1.8646532487958418 \cdot 10^{304}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - {z}^{2}, {x}^{2}\right) + y \cdot \left(\mathsf{fma}\left(-z, z, z \cdot z\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(y \cdot 4\right) \cdot \left(\sqrt{t} + z\right)\right) \cdot \left(\sqrt{t} - z\right)\right)\\
\end{array}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 temp;
if (((z * z) <= 1.8646532487958418e+304)) {
temp = (fma((y * 4.0), (t - pow(z, 2.0)), pow(x, 2.0)) + (y * (fma(-z, z, (z * z)) * 4.0)));
} else {
temp = fma(x, x, (((y * 4.0) * (sqrt(t) + z)) * (sqrt(t) - z)));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.0 |
|---|---|
| Target | 5.9 |
| Herbie | 3.2 |
if (* z z) < 1.8646532487958418e+304Initial program 0.1
Simplified0.1
rmApplied associate-*l*0.1
rmApplied fma-udef0.1
Simplified0.1
rmApplied add-sqr-sqrt32.3
Applied prod-diff32.3
Applied distribute-rgt-in32.3
Applied distribute-lft-in32.3
Applied associate-+r+32.3
Simplified0.1
if 1.8646532487958418e+304 < (* z z) Initial program 62.3
Simplified62.3
rmApplied add-sqr-sqrt63.3
Applied difference-of-squares63.3
Applied associate-*r*32.8
Final simplification3.2
herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4 (* y (- (* z z) t))))
(- (* x x) (* (* y 4) (- (* z z) t))))