?

Average Accuracy: 90.4% → 99.6%
Time: 12.7s
Precision: binary64
Cost: 1220

?

\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+249}:\\ \;\;\;\;x \cdot x + \left(\left(z \cdot z\right) \cdot y - y \cdot t\right) \cdot -4\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(4 \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) 5e+249)
   (+ (* x x) (* (- (* (* z z) y) (* y t)) -4.0))
   (- (* x x) (* z (* z (* 4.0 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) <= 5e+249) {
		tmp = (x * x) + ((((z * z) * y) - (y * t)) * -4.0);
	} else {
		tmp = (x * x) - (z * (z * (4.0 * y)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z * z) <= 5d+249) then
        tmp = (x * x) + ((((z * z) * y) - (y * t)) * (-4.0d0))
    else
        tmp = (x * x) - (z * (z * (4.0d0 * y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 5e+249) {
		tmp = (x * x) + ((((z * z) * y) - (y * t)) * -4.0);
	} else {
		tmp = (x * x) - (z * (z * (4.0 * y)));
	}
	return tmp;
}
def code(x, y, z, t):
	return (x * x) - ((y * 4.0) * ((z * z) - t))
def code(x, y, z, t):
	tmp = 0
	if (z * z) <= 5e+249:
		tmp = (x * x) + ((((z * z) * y) - (y * t)) * -4.0)
	else:
		tmp = (x * x) - (z * (z * (4.0 * y)))
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t)))
end
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 5e+249)
		tmp = Float64(Float64(x * x) + Float64(Float64(Float64(Float64(z * z) * y) - Float64(y * t)) * -4.0));
	else
		tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(4.0 * y))));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * z) <= 5e+249)
		tmp = (x * x) + ((((z * z) * y) - (y * t)) * -4.0);
	else
		tmp = (x * x) - (z * (z * (4.0 * y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+249], N[(N[(x * x), $MachinePrecision] + N[(N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+249}:\\
\;\;\;\;x \cdot x + \left(\left(z \cdot z\right) \cdot y - y \cdot t\right) \cdot -4\\

\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(4 \cdot y\right)\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original90.4%
Target90.4%
Herbie99.6%
\[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) < 4.9999999999999996e249

    1. Initial program 99.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied egg-rr99.9%

      \[\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)} \]
    3. Applied egg-rr99.9%

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

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

      [Start]99.9

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

      associate-*r* [=>]99.9

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

      *-commutative [<=]99.9

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

    if 4.9999999999999996e249 < (*.f64 z z)

    1. Initial program 29.3%

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

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

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

      [Start]27.3

      \[ x \cdot x - 4 \cdot \left(y \cdot {z}^{2}\right) \]

      associate-*r* [=>]27.3

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

      unpow2 [=>]27.3

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

      *-commutative [<=]27.3

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

      *-commutative [=>]27.3

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

      associate-*l* [=>]97.7

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

      *-commutative [=>]97.7

      \[ x \cdot x - z \cdot \left(z \cdot \color{blue}{\left(4 \cdot y\right)}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternatives

Alternative 1
Accuracy71.0%
Cost2516
\[\begin{array}{l} t_1 := z \cdot z - t\\ t_2 := \left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{-146}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq -5 \cdot 10^{-174}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;t_1 \leq -1 \cdot 10^{-257}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 10^{-168}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+298}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \]
Alternative 2
Accuracy89.8%
Cost1232
\[\begin{array}{l} t_1 := \left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ t_2 := x \cdot x - z \cdot \left(z \cdot \left(4 \cdot y\right)\right)\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{+49}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{-45}:\\ \;\;\;\;x \cdot x + t \cdot \left(4 \cdot y\right)\\ \mathbf{elif}\;z \leq 300000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy87.5%
Cost1104
\[\begin{array}{l} t_1 := \left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{+150}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-45}:\\ \;\;\;\;x \cdot x + t \cdot \left(4 \cdot y\right)\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy99.6%
Cost1092
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+249}:\\ \;\;\;\;x \cdot x + \left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(4 \cdot y\right)\right)\\ \end{array} \]
Alternative 5
Accuracy58.7%
Cost976
\[\begin{array}{l} t_1 := t \cdot \left(4 \cdot y\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{if}\;z \leq -7.8 \cdot 10^{+42}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-64}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Accuracy58.6%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{+41} \lor \neg \left(x \leq 0.195\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(4 \cdot y\right)\\ \end{array} \]
Alternative 7
Accuracy34.9%
Cost192
\[x \cdot x \]

Error

Reproduce?

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