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














Bits error versus x














Bits error versus y














Bits error versus z














Bits error versus t
Results
| Original | 6.1 |
|---|---|
| Target | 6.1 |
| Herbie | 0.2 |
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 1088 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 1281 |
| Alternative 3 | |
|---|---|
| Error | 7.0 |
| Cost | 2500 |
| Alternative 4 | |
|---|---|
| Error | 11.2 |
| Cost | 904 |
| Alternative 5 | |
|---|---|
| Error | 15.7 |
| Cost | 904 |
| Alternative 6 | |
|---|---|
| Error | 27.5 |
| Cost | 1604 |
| Alternative 7 | |
|---|---|
| Error | 25.7 |
| Cost | 648 |
| Alternative 8 | |
|---|---|
| Error | 41.1 |
| Cost | 192 |
| Alternative 9 | |
|---|---|
| Error | 60.5 |
| Cost | 64 |
| Alternative 10 | |
|---|---|
| Error | 61.5 |
| Cost | 64 |

if (*.f64 z z) < 1.11762453417636693e297Initial program 0.1
rmApplied sub-neg_binary64_174620.1
Applied distribute-rgt-in_binary64_174190.1
Simplified0.1
Simplified0.2
Simplified0.2
if 1.11762453417636693e297 < (*.f64 z z) Initial program 59.3
rmApplied sub-neg_binary64_1746259.3
Applied distribute-rgt-in_binary64_1741959.3
Simplified59.3
Simplified59.3
rmApplied associate-*r*_binary64_174090.3
Taylor expanded around inf 59.4
Simplified0.4
Simplified0.4
Final simplification0.2
herbie shell --seed 2021044
(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))))