Average Error: 6.1 → 0.1
Time: 10.0s
Precision: binary64
Cost: 1088
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
\[x \cdot x + \left(y \cdot \left(4 \cdot t\right) + z \cdot \left(z \cdot \left(y \cdot -4\right)\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) (+ (* y (* 4.0 t)) (* z (* z (* y -4.0))))))
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) + ((y * (4.0 * t)) + (z * (z * (y * -4.0))));
}
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) + ((y * (4.0d0 * t)) + (z * (z * (y * (-4.0d0)))))
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) + ((y * (4.0 * t)) + (z * (z * (y * -4.0))));
}
def code(x, y, z, t):
	return (x * x) - ((y * 4.0) * ((z * z) - t))
def code(x, y, z, t):
	return (x * x) + ((y * (4.0 * t)) + (z * (z * (y * -4.0))))
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(Float64(y * Float64(4.0 * t)) + Float64(z * Float64(z * Float64(y * -4.0)))))
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) + ((y * (4.0 * t)) + (z * (z * (y * -4.0))));
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[(N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
x \cdot x + \left(y \cdot \left(4 \cdot t\right) + z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.1
Target6.0
Herbie0.1
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right) \]

Derivation

  1. Initial program 6.1

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

    \[\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-rr0.1

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

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

Alternatives

Alternative 1
Error28.3
Cost1636
\[\begin{array}{l} t_1 := -4 \cdot \left(y \cdot \left(z \cdot z\right)\right)\\ t_2 := z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\ t_3 := 4 \cdot \left(y \cdot t\right)\\ \mathbf{if}\;z \leq -5.505444016060088 \cdot 10^{+19}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.1698192849326136 \cdot 10^{-18}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq -5.577129025036014 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.2474693617857973 \cdot 10^{-302}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 3.162918375367392 \cdot 10^{-225}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 8.082321023278036 \cdot 10^{-75}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 2.3722115748701626 \cdot 10^{-34}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 3.822536710616367 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+73}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error10.3
Cost1372
\[\begin{array}{l} t_1 := 4 \cdot \left(y \cdot \left(t - z \cdot z\right)\right)\\ t_2 := z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\ t_3 := x \cdot x + \left(y \cdot 4\right) \cdot t\\ \mathbf{if}\;z \leq -1 \cdot 10^{+110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.505444016060088 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.1698192849326136 \cdot 10^{-18}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -7.167181446894318 \cdot 10^{-77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.608472206027589 \cdot 10^{-18}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 3.822536710616367 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+73}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error7.3
Cost1232
\[\begin{array}{l} t_1 := x \cdot x + \left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\ \mathbf{if}\;z \leq -8.416112265681511 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.8242280433231024 \cdot 10^{-75}:\\ \;\;\;\;4 \cdot \left(y \cdot \left(t - z \cdot z\right)\right)\\ \mathbf{elif}\;z \leq -5.307831329293517 \cdot 10^{-98}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.3722115748701626 \cdot 10^{-34}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error7.3
Cost1232
\[\begin{array}{l} t_1 := x \cdot x + \left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\ \mathbf{if}\;z \leq -8.416112265681511 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.8242280433231024 \cdot 10^{-75}:\\ \;\;\;\;4 \cdot \left(y \cdot t - y \cdot \left(z \cdot z\right)\right)\\ \mathbf{elif}\;z \leq -5.307831329293517 \cdot 10^{-98}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.3722115748701626 \cdot 10^{-34}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.4
Cost1092
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{+210}:\\ \;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x + \left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\ \end{array} \]
Alternative 6
Error15.0
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -64026982909565.555:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq 51872.243274026856:\\ \;\;\;\;4 \cdot \left(y \cdot \left(t - z \cdot z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
Alternative 7
Error25.2
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1718947183192592 \cdot 10^{-58}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq 1.1728184254468744 \cdot 10^{-26}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
Alternative 8
Error41.2
Cost192
\[x \cdot x \]

Error

Reproduce

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