x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
\mathbf{if}\;z \leq -8.62635456860306 \cdot 10^{+140}:\\
\;\;\;\;x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\right)\\
\mathbf{elif}\;z \leq 1.3397190987904422 \cdot 10^{+154}:\\
\;\;\;\;x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z \cdot z\right) - \left(y \cdot 4\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - \left(e^{\log y + \left(\log 4 + \left(\log z + \log z\right)\right)} + -4 \cdot \left(y \cdot t\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 -8.62635456860306e+140)
(- (* x x) (* (* (* y 4.0) (+ z (sqrt t))) (- z (sqrt t))))
(if (<= z 1.3397190987904422e+154)
(- (* x x) (- (* (* y 4.0) (* z z)) (* (* y 4.0) t)))
(-
(* x x)
(+
(exp (+ (log y) (+ (log 4.0) (+ (log z) (log z)))))
(* -4.0 (* y 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 <= -8.62635456860306e+140) {
tmp = (x * x) - (((y * 4.0) * (z + sqrt(t))) * (z - sqrt(t)));
} else if (z <= 1.3397190987904422e+154) {
tmp = (x * x) - (((y * 4.0) * (z * z)) - ((y * 4.0) * t));
} else {
tmp = (x * x) - (exp(log(y) + (log(4.0) + (log(z) + log(z)))) + (-4.0 * (y * t)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.0 |
|---|---|
| Target | 6.0 |
| Herbie | 3.5 |
if z < -8.6263545686030595e140Initial program 55.4
rmApplied add-sqr-sqrt_binary64_1817360.0
Applied difference-of-squares_binary64_1812060.0
Applied associate-*r*_binary64_1809131.8
if -8.6263545686030595e140 < z < 1.3397190987904422e154Initial program 0.1
rmApplied sub-neg_binary64_181440.1
Applied distribute-rgt-in_binary64_181010.1
if 1.3397190987904422e154 < z Initial program 64.0
rmApplied sub-neg_binary64_1814464.0
Applied distribute-rgt-in_binary64_1810164.0
Simplified64.0
Simplified64.0
rmApplied add-exp-log_binary64_1818964.0
Applied add-exp-log_binary64_1818964.0
Applied prod-exp_binary64_1820064.0
Applied add-exp-log_binary64_1818964.0
Applied prod-exp_binary64_1820064.0
Applied add-exp-log_binary64_1818964.0
Applied prod-exp_binary64_1820036.2
Final simplification3.5
herbie shell --seed 2021015
(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))))