?

Average Accuracy: 90.7% → 99.9%
Time: 16.4s
Precision: binary64
Cost: 960

?

\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
\[x \cdot x + 4 \cdot \left(y \cdot t - z \cdot \left(z \cdot y\right)\right) \]
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
(FPCore (x y z t)
 :precision binary64
 (+ (* x x) (* 4.0 (- (* y t) (* z (* 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) {
	return (x * x) + (4.0 * ((y * t) - (z * (z * y))));
}
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
    code = (x * x) + (4.0d0 * ((y * t) - (z * (z * y))))
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) {
	return (x * x) + (4.0 * ((y * t) - (z * (z * y))));
}
def code(x, y, z, t):
	return (x * x) - ((y * 4.0) * ((z * z) - t))
def code(x, y, z, t):
	return (x * x) + (4.0 * ((y * t) - (z * (z * y))))
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)
	return Float64(Float64(x * x) + Float64(4.0 * Float64(Float64(y * t) - Float64(z * Float64(z * y)))))
end
function tmp = code(x, y, z, t)
	tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
end
function tmp = code(x, y, z, t)
	tmp = (x * x) + (4.0 * ((y * t) - (z * (z * y))));
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_] := N[(N[(x * x), $MachinePrecision] + N[(4.0 * N[(N[(y * t), $MachinePrecision] - N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
x \cdot x + 4 \cdot \left(y \cdot t - z \cdot \left(z \cdot y\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original90.7%
Target90.7%
Herbie99.9%
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right) \]

Derivation?

  1. Initial program 90.7%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Simplified90.6%

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

    [Start]90.7

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

    associate-*l* [=>]90.6

    \[ x \cdot x - \color{blue}{y \cdot \left(4 \cdot \left(z \cdot z - t\right)\right)} \]
  3. Applied egg-rr90.7%

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

    [Start]90.6

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

    associate-*r* [=>]90.7

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

    sub-neg [=>]90.7

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

    distribute-rgt-in [=>]90.7

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

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

    [Start]90.7

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

    associate-*r* [=>]90.7

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

    distribute-lft-neg-out [=>]90.7

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

    add-sqr-sqrt [=>]45.4

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

    sqrt-unprod [=>]59.0

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

    sqr-neg [<=]59.0

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

    sqrt-unprod [<=]26.4

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

    add-sqr-sqrt [<=]52.5

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

    cancel-sign-sub-inv [<=]52.5

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

    associate-*r* [=>]52.5

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

    distribute-rgt-out-- [=>]52.5

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

    associate-*l* [=>]61.7

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

    *-commutative [=>]61.7

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

    add-sqr-sqrt [=>]30.7

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

    sqrt-unprod [=>]66.1

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

    sqr-neg [=>]66.1

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

    sqrt-unprod [<=]50.4

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

    add-sqr-sqrt [<=]99.9

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

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

Alternatives

Alternative 1
Accuracy98.4%
Cost2121
\[\begin{array}{l} t_1 := z \cdot z - t\\ t_2 := \left(4 \cdot y\right) \cdot t_1\\ \mathbf{if}\;t_2 \leq -\infty \lor \neg \left(t_2 \leq 2 \cdot 10^{+277}\right):\\ \;\;\;\;x \cdot x + \left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + y \cdot \left(t_1 \cdot -4\right)\\ \end{array} \]
Alternative 2
Accuracy87.1%
Cost1496
\[\begin{array}{l} t_1 := y \cdot \left(z \cdot z\right)\\ t_2 := x \cdot x + -4 \cdot t_1\\ t_3 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ t_4 := x \cdot x + t \cdot \left(4 \cdot y\right)\\ \mathbf{if}\;z \leq -1 \cdot 10^{+119}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-33}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.48 \cdot 10^{-18}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;z \leq 210000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+52}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+139}:\\ \;\;\;\;4 \cdot \left(y \cdot t - t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Accuracy85.1%
Cost1364
\[\begin{array}{l} t_1 := x \cdot x + t \cdot \left(4 \cdot y\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{if}\;z \leq -3.8 \cdot 10^{+56}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+26}:\\ \;\;\;\;\left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7 \cdot 10^{+139}:\\ \;\;\;\;4 \cdot \left(y \cdot t - y \cdot \left(z \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Accuracy88.8%
Cost1364
\[\begin{array}{l} t_1 := x \cdot x + t \cdot \left(4 \cdot y\right)\\ t_2 := x \cdot x + \left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\ t_3 := y \cdot \left(z \cdot z\right)\\ \mathbf{if}\;z \leq -6.1 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+16}:\\ \;\;\;\;x \cdot x + -4 \cdot t_3\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.7 \cdot 10^{+133}:\\ \;\;\;\;4 \cdot \left(y \cdot t - t_3\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy57.9%
Cost1240
\[\begin{array}{l} t_1 := 4 \cdot \left(y \cdot t\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{if}\;z \leq -8 \cdot 10^{+38}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-47}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1160000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{+56}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Accuracy85.1%
Cost1236
\[\begin{array}{l} t_1 := x \cdot x + t \cdot \left(4 \cdot y\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ t_3 := \left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{+57}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.52 \cdot 10^{+26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+139}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Accuracy57.9%
Cost850
\[\begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+44} \lor \neg \left(x \leq 1000000000000\right) \land \left(x \leq 1.1 \cdot 10^{+50} \lor \neg \left(x \leq 2.05 \cdot 10^{+80}\right)\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 8
Accuracy74.3%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+44}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-22}:\\ \;\;\;\;\left(4 \cdot y\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{elif}\;x \leq 8 \cdot 10^{+49}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{+80}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
Alternative 9
Accuracy36.0%
Cost192
\[x \cdot x \]

Error

Reproduce?

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