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.5137466332070222 \cdot 10^{+302}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - 4 \cdot \left(\left(z + \sqrt{t}\right) \cdot \left(z \cdot y\right)\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.5137466332070222e+302) (- (* x x) (* (* y 4.0) (- (* z z) t))) (- (* x x) (* 4.0 (* (+ z (sqrt t)) (* z y))))))
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.5137466332070222e+302) {
tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
} else {
tmp = (x * x) - (4.0 * ((z + sqrt(t)) * (z * y)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.2 |
|---|---|
| Target | 6.2 |
| Herbie | 3.4 |
if (*.f64 z z) < 1.5137466332070222e302Initial program 0.1
if 1.5137466332070222e302 < (*.f64 z z) Initial program 61.7
rmApplied flip--_binary6464.0
Simplified64.0
Taylor expanded around 0 64.0
Simplified61.7
rmApplied add-sqr-sqrt_binary6462.8
Applied difference-of-squares_binary6462.8
Applied add-sqr-sqrt_binary6462.8
Applied times-frac_binary6460.9
Applied *-un-lft-identity_binary6460.9
Applied times-frac_binary6433.3
Simplified33.2
Simplified33.2
Taylor expanded around inf 33.2
Final simplification3.4
herbie shell --seed 2021118
(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))))