x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 1.1460343556713762 \cdot 10^{+281}:\\
\;\;\;\;x \cdot x - 4 \cdot \left(\left({z}^{2} - t\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - \left(\left(4 \cdot y\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\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 (<= (* z z) 1.1460343556713762e+281) (- (* x x) (* 4.0 (* (- (pow z 2.0) t) y))) (- (* x x) (* (* (* 4.0 y) (+ z (sqrt t))) (- z (sqrt t))))))
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 * z) <= 1.1460343556713762e+281) {
tmp = (x * x) - (4.0 * ((pow(z, 2.0) - t) * y));
} else {
tmp = (x * x) - (((4.0 * y) * (z + sqrt(t))) * (z - sqrt(t)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 5.8 |
|---|---|
| Target | 5.8 |
| Herbie | 3.2 |
if (*.f64 z z) < 1.1460343556713762e281Initial program 0.1
Taylor expanded around inf 0.1
if 1.1460343556713762e281 < (*.f64 z z) Initial program 53.7
rmApplied add-sqr-sqrt_binary64_1885558.1
Applied difference-of-squares_binary64_1880258.1
Applied associate-*r*_binary64_1877329.2
Final simplification3.2
herbie shell --seed 2021098
(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))))