Average Error: 5.9 → 0.3
Time: 13.2s
Precision: binary64
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
\[\begin{array}{l} \mathbf{if}\;z \leq -3.855894969108078 \cdot 10^{+108} \lor \neg \left(z \leq 5.023950248753564 \cdot 10^{+141}\right):\\ \;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\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 -3.855894969108078 \cdot 10^{+108} \lor \neg \left(z \leq 5.023950248753564 \cdot 10^{+141}\right):\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\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 (or (<= z -3.855894969108078e+108) (not (<= z 5.023950248753564e+141)))
   (- (* x x) (* z (* z (* y 4.0))))
   (+ (* x x) (* (* y 4.0) (- t (* z z))))))
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 <= -3.855894969108078e+108) || !(z <= 5.023950248753564e+141)) {
		tmp = (x * x) - (z * (z * (y * 4.0)));
	} else {
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	}
	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

Original5.9
Target5.8
Herbie0.3
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Split input into 2 regimes
  2. if z < -3.8558949691080778e108 or 5.0239502487535643e141 < z

    1. Initial program 45.2

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
    2. Taylor expanded around inf 46.3

      \[\leadsto x \cdot x - \color{blue}{4 \cdot \left({z}^{2} \cdot y\right)}\]
    3. Simplified1.3

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

    if -3.8558949691080778e108 < z < 5.0239502487535643e141

    1. Initial program 0.1

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.855894969108078 \cdot 10^{+108} \lor \neg \left(z \leq 5.023950248753564 \cdot 10^{+141}\right):\\ \;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021176 
(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))))