Average Error: 0.0 → 12.6
Time: 3.5s
Precision: binary64
Cost: 584
\[x \cdot x - \left(y \cdot 4\right) \cdot z \]
\[\begin{array}{l} \mathbf{if}\;x \leq -8.825758568846344 \cdot 10^{+58}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq 123168817.04912652:\\ \;\;\;\;z \cdot \left(-4 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x x) (* (* y 4.0) z)))
(FPCore (x y z)
 :precision binary64
 (if (<= x -8.825758568846344e+58)
   (* x x)
   (if (<= x 123168817.04912652) (* z (* -4.0 y)) (* x x))))
double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
double code(double x, double y, double z) {
	double tmp;
	if (x <= -8.825758568846344e+58) {
		tmp = x * x;
	} else if (x <= 123168817.04912652) {
		tmp = z * (-4.0 * y);
	} else {
		tmp = x * x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * x) - ((y * 4.0d0) * z)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-8.825758568846344d+58)) then
        tmp = x * x
    else if (x <= 123168817.04912652d0) then
        tmp = z * ((-4.0d0) * y)
    else
        tmp = x * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -8.825758568846344e+58) {
		tmp = x * x;
	} else if (x <= 123168817.04912652) {
		tmp = z * (-4.0 * y);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z):
	return (x * x) - ((y * 4.0) * z)
def code(x, y, z):
	tmp = 0
	if x <= -8.825758568846344e+58:
		tmp = x * x
	elif x <= 123168817.04912652:
		tmp = z * (-4.0 * y)
	else:
		tmp = x * x
	return tmp
function code(x, y, z)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * z))
end
function code(x, y, z)
	tmp = 0.0
	if (x <= -8.825758568846344e+58)
		tmp = Float64(x * x);
	elseif (x <= 123168817.04912652)
		tmp = Float64(z * Float64(-4.0 * y));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = (x * x) - ((y * 4.0) * z);
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -8.825758568846344e+58)
		tmp = x * x;
	elseif (x <= 123168817.04912652)
		tmp = z * (-4.0 * y);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[x, -8.825758568846344e+58], N[(x * x), $MachinePrecision], If[LessEqual[x, 123168817.04912652], N[(z * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
x \cdot x - \left(y \cdot 4\right) \cdot z
\begin{array}{l}
\mathbf{if}\;x \leq -8.825758568846344 \cdot 10^{+58}:\\
\;\;\;\;x \cdot x\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot x\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -8.82575856884634358e58 or 123168817.049126521 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    3. Simplified10.0

      \[\leadsto \color{blue}{x \cdot x} \]

    if -8.82575856884634358e58 < x < 123168817.049126521

    1. Initial program 0.0

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Taylor expanded in x around 0 13.5

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot z\right)} \]
    3. Simplified13.5

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

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

Alternatives

Alternative 1
Error35.9
Cost192
\[x \cdot x \]

Error

Reproduce

herbie shell --seed 2022325 
(FPCore (x y z)
  :name "Graphics.Rasterific.QuadraticFormula:discriminant from Rasterific-0.6.1"
  :precision binary64
  (- (* x x) (* (* y 4.0) z)))