Graphics.Rasterific.QuadraticFormula:discriminant from Rasterific-0.6.1

Percentage Accurate: 98.4% → 98.8%
Time: 4.1s
Alternatives: 5
Speedup: 0.1×

Specification

?
\[\begin{array}{l} \\ x \cdot x - \left(y \cdot 4\right) \cdot z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x x) (* (* y 4.0) z)))
double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
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
public static double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
def code(x, y, z):
	return (x * x) - ((y * 4.0) * z)
function code(x, y, z)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * z))
end
function tmp = code(x, y, z)
	tmp = (x * x) - ((y * 4.0) * z);
end
code[x_, y_, z_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot x - \left(y \cdot 4\right) \cdot z
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot x - \left(y \cdot 4\right) \cdot z \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x x) (* (* y 4.0) z)))
double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
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
public static double code(double x, double y, double z) {
	return (x * x) - ((y * 4.0) * z);
}
def code(x, y, z):
	return (x * x) - ((y * 4.0) * z)
function code(x, y, z)
	return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * z))
end
function tmp = code(x, y, z)
	tmp = (x * x) - ((y * 4.0) * z);
end
code[x_, y_, z_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot x - \left(y \cdot 4\right) \cdot z
\end{array}

Alternative 1: 98.8% accurate, 0.1× speedup?

\[\begin{array}{l} [y, z] = \mathsf{sort}([y, z])\\ \\ \mathsf{fma}\left(x, x, y \cdot \left(z \cdot -4\right)\right) \end{array} \]
NOTE: y and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (fma x x (* y (* z -4.0))))
assert(y < z);
double code(double x, double y, double z) {
	return fma(x, x, (y * (z * -4.0)));
}
y, z = sort([y, z])
function code(x, y, z)
	return fma(x, x, Float64(y * Float64(z * -4.0)))
end
NOTE: y and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * x + N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z] = \mathsf{sort}([y, z])\\
\\
\mathsf{fma}\left(x, x, y \cdot \left(z \cdot -4\right)\right)
\end{array}
Derivation
  1. Initial program 98.1%

    \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
  2. Step-by-step derivation
    1. fma-neg98.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot z\right)} \]
    2. associate-*l*98.8%

      \[\leadsto \mathsf{fma}\left(x, x, -\color{blue}{y \cdot \left(4 \cdot z\right)}\right) \]
    3. *-commutative98.8%

      \[\leadsto \mathsf{fma}\left(x, x, -y \cdot \color{blue}{\left(z \cdot 4\right)}\right) \]
    4. distribute-rgt-neg-in98.8%

      \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(-z \cdot 4\right)}\right) \]
    5. distribute-rgt-neg-in98.8%

      \[\leadsto \mathsf{fma}\left(x, x, y \cdot \color{blue}{\left(z \cdot \left(-4\right)\right)}\right) \]
    6. metadata-eval98.8%

      \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(z \cdot \color{blue}{-4}\right)\right) \]
  3. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, y \cdot \left(z \cdot -4\right)\right)} \]
  4. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(z \cdot -4\right)\right) \]

Alternative 2: 83.0% accurate, 0.5× speedup?

\[\begin{array}{l} [y, z] = \mathsf{sort}([y, z])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203} \lor \neg \left(x \cdot x \leq 7 \cdot 10^{-191}\right) \land x \cdot x \leq 5 \cdot 10^{-132}:\\ \;\;\;\;-4 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
NOTE: y and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x x) 4.3e-203)
         (and (not (<= (* x x) 7e-191)) (<= (* x x) 5e-132)))
   (* -4.0 (* y z))
   (* x x)))
assert(y < z);
double code(double x, double y, double z) {
	double tmp;
	if (((x * x) <= 4.3e-203) || (!((x * x) <= 7e-191) && ((x * x) <= 5e-132))) {
		tmp = -4.0 * (y * z);
	} else {
		tmp = x * x;
	}
	return tmp;
}
NOTE: y and z should be sorted in increasing order before calling this 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 * x) <= 4.3d-203) .or. (.not. ((x * x) <= 7d-191)) .and. ((x * x) <= 5d-132)) then
        tmp = (-4.0d0) * (y * z)
    else
        tmp = x * x
    end if
    code = tmp
end function
assert y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if (((x * x) <= 4.3e-203) || (!((x * x) <= 7e-191) && ((x * x) <= 5e-132))) {
		tmp = -4.0 * (y * z);
	} else {
		tmp = x * x;
	}
	return tmp;
}
[y, z] = sort([y, z])
def code(x, y, z):
	tmp = 0
	if ((x * x) <= 4.3e-203) or (not ((x * x) <= 7e-191) and ((x * x) <= 5e-132)):
		tmp = -4.0 * (y * z)
	else:
		tmp = x * x
	return tmp
y, z = sort([y, z])
function code(x, y, z)
	tmp = 0.0
	if ((Float64(x * x) <= 4.3e-203) || (!(Float64(x * x) <= 7e-191) && (Float64(x * x) <= 5e-132)))
		tmp = Float64(-4.0 * Float64(y * z));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
y, z = num2cell(sort([y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (((x * x) <= 4.3e-203) || (~(((x * x) <= 7e-191)) && ((x * x) <= 5e-132)))
		tmp = -4.0 * (y * z);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
NOTE: y and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 4.3e-203], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 7e-191]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 5e-132]]], N[(-4.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
[y, z] = \mathsf{sort}([y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203} \lor \neg \left(x \cdot x \leq 7 \cdot 10^{-191}\right) \land x \cdot x \leq 5 \cdot 10^{-132}:\\
\;\;\;\;-4 \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.30000000000000027e-203 or 7.00000000000000013e-191 < (*.f64 x x) < 4.9999999999999999e-132

    1. Initial program 99.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

        \[\leadsto x \cdot x - \color{blue}{y \cdot \left(4 \cdot z\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
    4. Taylor expanded in x around 0 97.0%

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

    if 4.30000000000000027e-203 < (*.f64 x x) < 7.00000000000000013e-191 or 4.9999999999999999e-132 < (*.f64 x x)

    1. Initial program 97.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*l*96.9%

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

      \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
    4. Taylor expanded in x around inf 79.9%

      \[\leadsto \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow279.9%

        \[\leadsto \color{blue}{x \cdot x} \]
    6. Simplified79.9%

      \[\leadsto \color{blue}{x \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203} \lor \neg \left(x \cdot x \leq 7 \cdot 10^{-191}\right) \land x \cdot x \leq 5 \cdot 10^{-132}:\\ \;\;\;\;-4 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 3: 83.0% accurate, 0.5× speedup?

\[\begin{array}{l} [y, z] = \mathsf{sort}([y, z])\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203}:\\ \;\;\;\;y \cdot \left(z \cdot -4\right)\\ \mathbf{elif}\;x \cdot x \leq 7 \cdot 10^{-191}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{-132}:\\ \;\;\;\;-4 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
NOTE: y and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (* x x) 4.3e-203)
   (* y (* z -4.0))
   (if (<= (* x x) 7e-191)
     (* x x)
     (if (<= (* x x) 4.8e-132) (* -4.0 (* y z)) (* x x)))))
assert(y < z);
double code(double x, double y, double z) {
	double tmp;
	if ((x * x) <= 4.3e-203) {
		tmp = y * (z * -4.0);
	} else if ((x * x) <= 7e-191) {
		tmp = x * x;
	} else if ((x * x) <= 4.8e-132) {
		tmp = -4.0 * (y * z);
	} else {
		tmp = x * x;
	}
	return tmp;
}
NOTE: y and z should be sorted in increasing order before calling this 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 * x) <= 4.3d-203) then
        tmp = y * (z * (-4.0d0))
    else if ((x * x) <= 7d-191) then
        tmp = x * x
    else if ((x * x) <= 4.8d-132) then
        tmp = (-4.0d0) * (y * z)
    else
        tmp = x * x
    end if
    code = tmp
end function
assert y < z;
public static double code(double x, double y, double z) {
	double tmp;
	if ((x * x) <= 4.3e-203) {
		tmp = y * (z * -4.0);
	} else if ((x * x) <= 7e-191) {
		tmp = x * x;
	} else if ((x * x) <= 4.8e-132) {
		tmp = -4.0 * (y * z);
	} else {
		tmp = x * x;
	}
	return tmp;
}
[y, z] = sort([y, z])
def code(x, y, z):
	tmp = 0
	if (x * x) <= 4.3e-203:
		tmp = y * (z * -4.0)
	elif (x * x) <= 7e-191:
		tmp = x * x
	elif (x * x) <= 4.8e-132:
		tmp = -4.0 * (y * z)
	else:
		tmp = x * x
	return tmp
y, z = sort([y, z])
function code(x, y, z)
	tmp = 0.0
	if (Float64(x * x) <= 4.3e-203)
		tmp = Float64(y * Float64(z * -4.0));
	elseif (Float64(x * x) <= 7e-191)
		tmp = Float64(x * x);
	elseif (Float64(x * x) <= 4.8e-132)
		tmp = Float64(-4.0 * Float64(y * z));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
y, z = num2cell(sort([y, z])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x * x) <= 4.3e-203)
		tmp = y * (z * -4.0);
	elseif ((x * x) <= 7e-191)
		tmp = x * x;
	elseif ((x * x) <= 4.8e-132)
		tmp = -4.0 * (y * z);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
NOTE: y and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[N[(x * x), $MachinePrecision], 4.3e-203], N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 7e-191], N[(x * x), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 4.8e-132], N[(-4.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]]
\begin{array}{l}
[y, z] = \mathsf{sort}([y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203}:\\
\;\;\;\;y \cdot \left(z \cdot -4\right)\\

\mathbf{elif}\;x \cdot x \leq 7 \cdot 10^{-191}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{-132}:\\
\;\;\;\;-4 \cdot \left(y \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 4.30000000000000027e-203

    1. Initial program 98.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

        \[\leadsto x \cdot x - \color{blue}{y \cdot \left(4 \cdot z\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
    4. Taylor expanded in x around 0 97.8%

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot z\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u71.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-4 \cdot \left(y \cdot z\right)\right)\right)} \]
      2. expm1-udef39.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-4 \cdot \left(y \cdot z\right)\right)} - 1} \]
      3. log1p-udef39.6%

        \[\leadsto e^{\color{blue}{\log \left(1 + -4 \cdot \left(y \cdot z\right)\right)}} - 1 \]
      4. add-exp-log65.5%

        \[\leadsto \color{blue}{\left(1 + -4 \cdot \left(y \cdot z\right)\right)} - 1 \]
    6. Applied egg-rr65.5%

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \left(y \cdot z\right)\right) - 1} \]
    7. Step-by-step derivation
      1. +-commutative65.5%

        \[\leadsto \color{blue}{\left(-4 \cdot \left(y \cdot z\right) + 1\right)} - 1 \]
      2. associate--l+97.8%

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot z\right) + \left(1 - 1\right)} \]
      3. *-commutative97.8%

        \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot -4} + \left(1 - 1\right) \]
      4. metadata-eval97.8%

        \[\leadsto \left(y \cdot z\right) \cdot -4 + \color{blue}{0} \]
      5. associate-*l*97.9%

        \[\leadsto \color{blue}{y \cdot \left(z \cdot -4\right)} + 0 \]
    8. Simplified97.9%

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

    if 4.30000000000000027e-203 < (*.f64 x x) < 7.00000000000000013e-191 or 4.80000000000000031e-132 < (*.f64 x x)

    1. Initial program 97.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*l*96.9%

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

      \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
    4. Taylor expanded in x around inf 79.9%

      \[\leadsto \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow279.9%

        \[\leadsto \color{blue}{x \cdot x} \]
    6. Simplified79.9%

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

    if 7.00000000000000013e-191 < (*.f64 x x) < 4.80000000000000031e-132

    1. Initial program 100.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
    2. Step-by-step derivation
      1. associate-*l*100.0%

        \[\leadsto x \cdot x - \color{blue}{y \cdot \left(4 \cdot z\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
    4. Taylor expanded in x around 0 83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.3 \cdot 10^{-203}:\\ \;\;\;\;y \cdot \left(z \cdot -4\right)\\ \mathbf{elif}\;x \cdot x \leq 7 \cdot 10^{-191}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{-132}:\\ \;\;\;\;-4 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 4: 98.4% accurate, 1.0× speedup?

\[\begin{array}{l} [y, z] = \mathsf{sort}([y, z])\\ \\ x \cdot x - y \cdot \left(z \cdot 4\right) \end{array} \]
NOTE: y and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (- (* x x) (* y (* z 4.0))))
assert(y < z);
double code(double x, double y, double z) {
	return (x * x) - (y * (z * 4.0));
}
NOTE: y and z should be sorted in increasing order before calling this function.
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 * (z * 4.0d0))
end function
assert y < z;
public static double code(double x, double y, double z) {
	return (x * x) - (y * (z * 4.0));
}
[y, z] = sort([y, z])
def code(x, y, z):
	return (x * x) - (y * (z * 4.0))
y, z = sort([y, z])
function code(x, y, z)
	return Float64(Float64(x * x) - Float64(y * Float64(z * 4.0)))
end
y, z = num2cell(sort([y, z])){:}
function tmp = code(x, y, z)
	tmp = (x * x) - (y * (z * 4.0));
end
NOTE: y and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[(x * x), $MachinePrecision] - N[(y * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z] = \mathsf{sort}([y, z])\\
\\
x \cdot x - y \cdot \left(z \cdot 4\right)
\end{array}
Derivation
  1. Initial program 98.1%

    \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
  2. Step-by-step derivation
    1. associate-*l*98.1%

      \[\leadsto x \cdot x - \color{blue}{y \cdot \left(4 \cdot z\right)} \]
  3. Simplified98.1%

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

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

Alternative 5: 53.6% accurate, 3.0× speedup?

\[\begin{array}{l} [y, z] = \mathsf{sort}([y, z])\\ \\ x \cdot x \end{array} \]
NOTE: y and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* x x))
assert(y < z);
double code(double x, double y, double z) {
	return x * x;
}
NOTE: y and z should be sorted in increasing order before calling this function.
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
end function
assert y < z;
public static double code(double x, double y, double z) {
	return x * x;
}
[y, z] = sort([y, z])
def code(x, y, z):
	return x * x
y, z = sort([y, z])
function code(x, y, z)
	return Float64(x * x)
end
y, z = num2cell(sort([y, z])){:}
function tmp = code(x, y, z)
	tmp = x * x;
end
NOTE: y and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
[y, z] = \mathsf{sort}([y, z])\\
\\
x \cdot x
\end{array}
Derivation
  1. Initial program 98.1%

    \[x \cdot x - \left(y \cdot 4\right) \cdot z \]
  2. Step-by-step derivation
    1. associate-*l*98.1%

      \[\leadsto x \cdot x - \color{blue}{y \cdot \left(4 \cdot z\right)} \]
  3. Simplified98.1%

    \[\leadsto \color{blue}{x \cdot x - y \cdot \left(4 \cdot z\right)} \]
  4. Taylor expanded in x around inf 56.5%

    \[\leadsto \color{blue}{{x}^{2}} \]
  5. Step-by-step derivation
    1. unpow256.5%

      \[\leadsto \color{blue}{x \cdot x} \]
  6. Simplified56.5%

    \[\leadsto \color{blue}{x \cdot x} \]
  7. Final simplification56.5%

    \[\leadsto x \cdot x \]

Reproduce

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