Average Error: 6.2 → 3.4
Time: 8.4s
Precision: binary64
\[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}\]
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;
}

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.2
Target6.2
Herbie3.4
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 z z) < 1.5137466332070222e302

    1. Initial program 0.1

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]

    if 1.5137466332070222e302 < (*.f64 z z)

    1. Initial program 61.7

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

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

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{4} - t \cdot t}}{z \cdot z + t}\]
    5. Taylor expanded around 0 64.0

      \[\leadsto x \cdot x - \color{blue}{4 \cdot \frac{y \cdot \left({z}^{4} - {t}^{2}\right)}{{z}^{2} + t}}\]
    6. Simplified61.7

      \[\leadsto x \cdot x - \color{blue}{4 \cdot \frac{y}{\frac{1}{z \cdot z - t}}}\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt_binary6462.8

      \[\leadsto x \cdot x - 4 \cdot \frac{y}{\frac{1}{z \cdot z - \color{blue}{\sqrt{t} \cdot \sqrt{t}}}}\]
    9. Applied difference-of-squares_binary6462.8

      \[\leadsto x \cdot x - 4 \cdot \frac{y}{\frac{1}{\color{blue}{\left(z + \sqrt{t}\right) \cdot \left(z - \sqrt{t}\right)}}}\]
    10. Applied add-sqr-sqrt_binary6462.8

      \[\leadsto x \cdot x - 4 \cdot \frac{y}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\left(z + \sqrt{t}\right) \cdot \left(z - \sqrt{t}\right)}}\]
    11. Applied times-frac_binary6460.9

      \[\leadsto x \cdot x - 4 \cdot \frac{y}{\color{blue}{\frac{\sqrt{1}}{z + \sqrt{t}} \cdot \frac{\sqrt{1}}{z - \sqrt{t}}}}\]
    12. Applied *-un-lft-identity_binary6460.9

      \[\leadsto x \cdot x - 4 \cdot \frac{\color{blue}{1 \cdot y}}{\frac{\sqrt{1}}{z + \sqrt{t}} \cdot \frac{\sqrt{1}}{z - \sqrt{t}}}\]
    13. Applied times-frac_binary6433.3

      \[\leadsto x \cdot x - 4 \cdot \color{blue}{\left(\frac{1}{\frac{\sqrt{1}}{z + \sqrt{t}}} \cdot \frac{y}{\frac{\sqrt{1}}{z - \sqrt{t}}}\right)}\]
    14. Simplified33.2

      \[\leadsto x \cdot x - 4 \cdot \left(\color{blue}{\left(z + \sqrt{t}\right)} \cdot \frac{y}{\frac{\sqrt{1}}{z - \sqrt{t}}}\right)\]
    15. Simplified33.2

      \[\leadsto x \cdot x - 4 \cdot \left(\left(z + \sqrt{t}\right) \cdot \color{blue}{\left(y \cdot \left(z - \sqrt{t}\right)\right)}\right)\]
    16. Taylor expanded around inf 33.2

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

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

Alternatives

Reproduce

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