Average Error: 6.0 → 3.5
Time: 7.7s
Precision: binary64
\[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}\]
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;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.0
Target6.0
Herbie3.5
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Split input into 3 regimes
  2. if z < -8.6263545686030595e140

    1. Initial program 55.4

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt_binary64_1817360.0

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)\]
    4. Applied difference-of-squares_binary64_1812060.0

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(\left(z + \sqrt{t}\right) \cdot \left(z - \sqrt{t}\right)\right)}\]
    5. Applied associate-*r*_binary64_1809131.8

      \[\leadsto x \cdot x - \color{blue}{\left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\right)}\]

    if -8.6263545686030595e140 < z < 1.3397190987904422e154

    1. Initial program 0.1

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
    2. Using strategy rm
    3. Applied sub-neg_binary64_181440.1

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)}\]
    4. Applied distribute-rgt-in_binary64_181010.1

      \[\leadsto x \cdot x - \color{blue}{\left(\left(z \cdot z\right) \cdot \left(y \cdot 4\right) + \left(-t\right) \cdot \left(y \cdot 4\right)\right)}\]

    if 1.3397190987904422e154 < z

    1. Initial program 64.0

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
    2. Using strategy rm
    3. Applied sub-neg_binary64_1814464.0

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)}\]
    4. Applied distribute-rgt-in_binary64_1810164.0

      \[\leadsto x \cdot x - \color{blue}{\left(\left(z \cdot z\right) \cdot \left(y \cdot 4\right) + \left(-t\right) \cdot \left(y \cdot 4\right)\right)}\]
    5. Simplified64.0

      \[\leadsto x \cdot x - \left(\color{blue}{y \cdot \left(4 \cdot \left(z \cdot z\right)\right)} + \left(-t\right) \cdot \left(y \cdot 4\right)\right)\]
    6. Simplified64.0

      \[\leadsto x \cdot x - \left(y \cdot \left(4 \cdot \left(z \cdot z\right)\right) + \color{blue}{-4 \cdot \left(y \cdot t\right)}\right)\]
    7. Using strategy rm
    8. Applied add-exp-log_binary64_1818964.0

      \[\leadsto x \cdot x - \left(y \cdot \left(4 \cdot \left(z \cdot \color{blue}{e^{\log z}}\right)\right) + -4 \cdot \left(y \cdot t\right)\right)\]
    9. Applied add-exp-log_binary64_1818964.0

      \[\leadsto x \cdot x - \left(y \cdot \left(4 \cdot \left(\color{blue}{e^{\log z}} \cdot e^{\log z}\right)\right) + -4 \cdot \left(y \cdot t\right)\right)\]
    10. Applied prod-exp_binary64_1820064.0

      \[\leadsto x \cdot x - \left(y \cdot \left(4 \cdot \color{blue}{e^{\log z + \log z}}\right) + -4 \cdot \left(y \cdot t\right)\right)\]
    11. Applied add-exp-log_binary64_1818964.0

      \[\leadsto x \cdot x - \left(y \cdot \left(\color{blue}{e^{\log 4}} \cdot e^{\log z + \log z}\right) + -4 \cdot \left(y \cdot t\right)\right)\]
    12. Applied prod-exp_binary64_1820064.0

      \[\leadsto x \cdot x - \left(y \cdot \color{blue}{e^{\log 4 + \left(\log z + \log z\right)}} + -4 \cdot \left(y \cdot t\right)\right)\]
    13. Applied add-exp-log_binary64_1818964.0

      \[\leadsto x \cdot x - \left(\color{blue}{e^{\log y}} \cdot e^{\log 4 + \left(\log z + \log z\right)} + -4 \cdot \left(y \cdot t\right)\right)\]
    14. Applied prod-exp_binary64_1820036.2

      \[\leadsto x \cdot x - \left(\color{blue}{e^{\log y + \left(\log 4 + \left(\log z + \log z\right)\right)}} + -4 \cdot \left(y \cdot t\right)\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.5

    \[\leadsto \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}\]

Reproduce

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))))