Average Error: 6.3 → 3.5
Time: 8.2s
Precision: binary64
Cost: 14209
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 7.797257741793615 \cdot 10^{+303}:\\ \;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\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 7.797257741793615 \cdot 10^{+303}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\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) 7.797257741793615e+303)
   (- (* x x) (* (* y 4.0) (- (* z z) t)))
   (- (* x x) (* (* (* y 4.0) (+ z (sqrt t))) (- z (sqrt 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 * z) <= 7.797257741793615e+303) {
		tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
	} else {
		tmp = (x * x) - (((y * 4.0) * (z + sqrt(t))) * (z - sqrt(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.3
Target6.2
Herbie3.5
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Alternatives

Alternative 1
Error29.2
Cost34560
\[x \cdot x - \left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \cdot \frac{\sqrt[3]{\left(y \cdot 4\right) \cdot \left({z}^{4} - t \cdot t\right)}}{\sqrt[3]{t + z \cdot z}}\]
Alternative 2
Error6.9
Cost27712
\[x \cdot x - \left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \cdot \left(\sqrt[3]{y \cdot 4} \cdot \sqrt[3]{z \cdot z - t}\right)\]
Alternative 3
Error30.2
Cost27584
\[x \cdot x - \left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \cdot \left(\sqrt[3]{4} \cdot \sqrt[3]{y \cdot \left(z \cdot z\right)}\right)\]
Alternative 4
Error7.0
Cost21312
\[x \cdot x - \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right)\]
Alternative 5
Error19.2
Cost21056
\[x \cdot x - \left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \cdot \sqrt[3]{y \cdot \left(t \cdot -4\right)}\]
Alternative 6
Error49.0
Cost20992
\[\frac{{x}^{6} - {\left(y \cdot \left(t \cdot -4\right)\right)}^{3}}{{x}^{4} + y \cdot \left(\left(t \cdot -4\right) \cdot \left(x \cdot x + y \cdot \left(t \cdot -4\right)\right)\right)}\]
Alternative 7
Error42.2
Cost14784
\[x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{6} - {t}^{3}\right)}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) + \left(t \cdot t + t \cdot \left(z \cdot z\right)\right)}\]
Alternative 8
Error25.1
Cost14528
\[\sqrt{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\]
Alternative 9
Error32.6
Cost14272
\[x \cdot x - \sqrt{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\]
Alternative 10
Error26.5
Cost14016
\[x \cdot x - \sqrt{z \cdot z - t} \cdot \left(\left(y \cdot 4\right) \cdot \sqrt{z \cdot z - t}\right)\]
Alternative 11
Error31.9
Cost13760
\[x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\right)\]
Alternative 12
Error33.7
Cost13696
\[x \cdot x - \left(y \cdot 4\right) \cdot \sqrt[3]{{\left(z \cdot z - t\right)}^{3}}\]
Alternative 13
Error46.0
Cost13440
\[\sqrt[3]{{\left(y \cdot \left(4 \cdot t\right) + x \cdot x\right)}^{3}}\]
Alternative 14
Error60.4
Cost13376
\[\log \left(e^{y \cdot \left(4 \cdot t\right) + x \cdot x}\right)\]
Alternative 15
Error33.0
Cost13376
\[e^{\log \left(y \cdot \left(4 \cdot t\right) + x \cdot x\right)}\]
Alternative 16
Error43.5
Cost8576
\[\frac{{x}^{4} - y \cdot \left(\left(\left(z \cdot z - t\right) \cdot \left(z \cdot z - t\right)\right) \cdot \left(y \cdot 16\right)\right)}{x \cdot x + \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\]
Alternative 17
Error29.0
Cost7680
\[x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{4} - t \cdot t\right)}{t + z \cdot z}\]
Alternative 18
Error25.6
Cost7680
\[x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - t \cdot t}{t + z \cdot z}\]
Alternative 19
Error6.3
Cost1088
\[x \cdot x - \left(y \cdot \left(t \cdot -4\right) + \left(y \cdot 4\right) \cdot \left(z \cdot z\right)\right)\]
Alternative 20
Error6.3
Cost832
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
Alternative 21
Error30.1
Cost704
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z\right)\]
Alternative 22
Error17.9
Cost576
\[y \cdot \left(4 \cdot t\right) + x \cdot x\]
Alternative 23
Error25.2
Cost576
\[y \cdot \left(-4 \cdot \left(z \cdot z - t\right)\right)\]
Alternative 24
Error48.6
Cost448
\[-4 \cdot \left(y \cdot \left(z \cdot z\right)\right)\]
Alternative 25
Error37.3
Cost320
\[y \cdot \left(4 \cdot t\right)\]
Alternative 26
Error41.5
Cost192
\[x \cdot x\]
Alternative 27
Error61.4
Cost64
\[1\]
Alternative 28
Error60.6
Cost64
\[0\]
Alternative 29
Error62.2
Cost64
\[-1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 z z) < 7.79725774179361499e303

    1. Initial program 0.1

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
    2. Simplified0.1

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

    if 7.79725774179361499e303 < (*.f64 z z)

    1. Initial program 62.6

      \[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_1974063.4

      \[\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_1968763.4

      \[\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_1965834.2

      \[\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)}\]
    6. Simplified34.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 7.797257741793615 \cdot 10^{+303}:\\ \;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(\left(y \cdot 4\right) \cdot \left(z + \sqrt{t}\right)\right) \cdot \left(z - \sqrt{t}\right)\\ \end{array}\]

Reproduce

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