Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B

Percentage Accurate: 91.2% → 96.4%
Time: 12.9s
Alternatives: 8
Speedup: 0.6×

Specification

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

\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\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 8 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: 91.2% accurate, 1.0× speedup?

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

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

Alternative 1: 96.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(z \cdot y\right) \cdot \left(z \cdot 4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 5e+217)
   (fma (* y 4.0) (- t (* z z)) (* x x))
   (- (* x x) (* (* z y) (* z 4.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 5e+217) {
		tmp = fma((y * 4.0), (t - (z * z)), (x * x));
	} else {
		tmp = (x * x) - ((z * y) * (z * 4.0));
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 5e+217)
		tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x));
	else
		tmp = Float64(Float64(x * x) - Float64(Float64(z * y) * Float64(z * 4.0)));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+217], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 5.00000000000000041e217

    1. Initial program 96.4%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv96.4%

        \[\leadsto \color{blue}{x \cdot x + \left(-y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. distribute-lft-neg-out96.4%

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

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot 4\right) \cdot \left(z \cdot z - t\right) + x \cdot x} \]
      4. associate-*l*96.4%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \left(4 \cdot \left(z \cdot z - t\right)\right)} + x \cdot x \]
      5. distribute-lft-neg-in96.4%

        \[\leadsto \color{blue}{\left(-y \cdot \left(4 \cdot \left(z \cdot z - t\right)\right)\right)} + x \cdot x \]
      6. associate-*l*96.4%

        \[\leadsto \left(-\color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) + x \cdot x \]
      7. distribute-rgt-neg-in96.4%

        \[\leadsto \color{blue}{\left(y \cdot 4\right) \cdot \left(-\left(z \cdot z - t\right)\right)} + x \cdot x \]
      8. fma-define99.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, -\left(z \cdot z - t\right), x \cdot x\right)} \]
      9. sub-neg99.4%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(z \cdot z + \left(-t\right)\right)}, x \cdot x\right) \]
      10. +-commutative99.4%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, -\color{blue}{\left(\left(-t\right) + z \cdot z\right)}, x \cdot x\right) \]
      11. distribute-neg-in99.4%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{\left(-\left(-t\right)\right) + \left(-z \cdot z\right)}, x \cdot x\right) \]
      12. remove-double-neg99.4%

        \[\leadsto \mathsf{fma}\left(y \cdot 4, \color{blue}{t} + \left(-z \cdot z\right), x \cdot x\right) \]
      13. sub-neg99.4%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)} \]
    4. Add Preprocessing

    if 5.00000000000000041e217 < (*.f64 z z)

    1. Initial program 74.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg74.5%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
      2. flip-+6.0%

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{2}} \cdot \left(z \cdot z\right) - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      4. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      6. metadata-eval6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      7. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
    4. Applied egg-rr6.0%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
    5. Step-by-step derivation
      1. clear-num6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      2. un-div-inv6.0%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      3. clear-num6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
      4. metadata-eval6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      6. flip-+74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
      7. unpow274.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
      8. fma-define74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
      9. add-sqr-sqrt34.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
      10. sqrt-prod74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
      11. sqr-neg74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
      12. sqrt-prod40.1%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
      13. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
    6. Applied egg-rr74.5%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
    7. Taylor expanded in z around inf 74.5%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      2. times-frac74.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{y}{\sqrt{\frac{1}{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}}} \]
      3. sqrt-div74.5%

        \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      4. metadata-eval74.5%

        \[\leadsto x \cdot x - \frac{y}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      5. sqrt-pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      6. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{{z}^{\color{blue}{1}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. sqrt-div44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \]
      9. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      10. sqrt-pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \]
      11. metadata-eval96.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{{z}^{\color{blue}{1}}}} \]
      12. pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{z}}} \]
    9. Applied egg-rr96.4%

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{z}}} \]
    10. Step-by-step derivation
      1. associate-/r/96.4%

        \[\leadsto x \cdot x - \color{blue}{\left(\frac{y}{1} \cdot z\right)} \cdot \frac{4}{\frac{1}{z}} \]
      2. /-rgt-identity96.4%

        \[\leadsto x \cdot x - \left(\color{blue}{y} \cdot z\right) \cdot \frac{4}{\frac{1}{z}} \]
      3. associate-/r/96.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(z \cdot y\right) \cdot \left(z \cdot 4\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 96.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(z \cdot y\right) \cdot \left(z \cdot 4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 5e+217)
   (fma x x (* (- (* z z) t) (* y -4.0)))
   (- (* x x) (* (* z y) (* z 4.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 5e+217) {
		tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
	} else {
		tmp = (x * x) - ((z * y) * (z * 4.0));
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 5e+217)
		tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x * x) - Float64(Float64(z * y) * Float64(z * 4.0)));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+217], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 5.00000000000000041e217

    1. Initial program 96.4%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)} \]
      2. distribute-lft-neg-in97.0%

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \color{blue}{\left(y \cdot \left(-4\right)\right)}\right) \]
      5. metadata-eval97.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing

    if 5.00000000000000041e217 < (*.f64 z z)

    1. Initial program 74.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg74.5%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
      2. flip-+6.0%

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{2}} \cdot \left(z \cdot z\right) - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      4. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      6. metadata-eval6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      7. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
    4. Applied egg-rr6.0%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
    5. Step-by-step derivation
      1. clear-num6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      2. un-div-inv6.0%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      3. clear-num6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
      4. metadata-eval6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      6. flip-+74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
      7. unpow274.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
      8. fma-define74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
      9. add-sqr-sqrt34.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
      10. sqrt-prod74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
      11. sqr-neg74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
      12. sqrt-prod40.1%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
      13. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
    6. Applied egg-rr74.5%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
    7. Taylor expanded in z around inf 74.5%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      2. times-frac74.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{y}{\sqrt{\frac{1}{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}}} \]
      3. sqrt-div74.5%

        \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      4. metadata-eval74.5%

        \[\leadsto x \cdot x - \frac{y}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      5. sqrt-pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      6. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{{z}^{\color{blue}{1}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. sqrt-div44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \]
      9. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      10. sqrt-pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \]
      11. metadata-eval96.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{{z}^{\color{blue}{1}}}} \]
      12. pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{z}}} \]
    9. Applied egg-rr96.4%

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{z}}} \]
    10. Step-by-step derivation
      1. associate-/r/96.4%

        \[\leadsto x \cdot x - \color{blue}{\left(\frac{y}{1} \cdot z\right)} \cdot \frac{4}{\frac{1}{z}} \]
      2. /-rgt-identity96.4%

        \[\leadsto x \cdot x - \left(\color{blue}{y} \cdot z\right) \cdot \frac{4}{\frac{1}{z}} \]
      3. associate-/r/96.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - \left(z \cdot y\right) \cdot \left(z \cdot 4\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+217}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 5.00000000000000041e217

    1. Initial program 96.4%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if 5.00000000000000041e217 < (*.f64 z z)

    1. Initial program 74.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg74.5%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
      2. flip-+6.0%

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{2}} \cdot \left(z \cdot z\right) - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      4. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      6. metadata-eval6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      7. pow26.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
    4. Applied egg-rr6.0%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
    5. Step-by-step derivation
      1. clear-num6.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      2. un-div-inv6.0%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      3. clear-num6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
      4. metadata-eval6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      5. pow-prod-up6.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      6. flip-+74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
      7. unpow274.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
      8. fma-define74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
      9. add-sqr-sqrt34.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
      10. sqrt-prod74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
      11. sqr-neg74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
      12. sqrt-prod40.1%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
      13. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
    6. Applied egg-rr74.5%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
    7. Taylor expanded in z around inf 74.5%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt74.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      2. times-frac74.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{y}{\sqrt{\frac{1}{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}}} \]
      3. sqrt-div74.5%

        \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      4. metadata-eval74.5%

        \[\leadsto x \cdot x - \frac{y}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      5. sqrt-pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      6. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{{z}^{\color{blue}{1}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. pow144.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. sqrt-div44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \]
      9. metadata-eval44.7%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      10. sqrt-pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \]
      11. metadata-eval96.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{{z}^{\color{blue}{1}}}} \]
      12. pow196.4%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{z}}} \]
    9. Applied egg-rr96.4%

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{z}}} \]
    10. Step-by-step derivation
      1. associate-/r/96.4%

        \[\leadsto x \cdot x - \color{blue}{\left(\frac{y}{1} \cdot z\right)} \cdot \frac{4}{\frac{1}{z}} \]
      2. /-rgt-identity96.4%

        \[\leadsto x \cdot x - \left(\color{blue}{y} \cdot z\right) \cdot \frac{4}{\frac{1}{z}} \]
      3. associate-/r/96.4%

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

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

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

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

Alternative 4: 77.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{+62}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.00000000000000007e62

    1. Initial program 90.6%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 76.9%

      \[\leadsto x \cdot x - \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. *-commutative76.9%

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

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

    if 2.00000000000000007e62 < z

    1. Initial program 82.7%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg82.7%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
      2. flip-+12.3%

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

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      5. pow-prod-up12.4%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      6. metadata-eval12.4%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      7. pow212.4%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
    4. Applied egg-rr12.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
    5. Step-by-step derivation
      1. clear-num12.4%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      2. un-div-inv12.4%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      3. clear-num12.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
      4. metadata-eval12.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      5. pow-prod-up12.3%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      6. flip-+82.7%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
      7. unpow282.7%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
      8. fma-define82.7%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
      9. add-sqr-sqrt32.3%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
      10. sqrt-prod80.8%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
      11. sqr-neg80.8%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
      12. sqrt-prod49.8%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
      13. add-sqr-sqrt82.2%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
    6. Applied egg-rr82.2%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
    7. Taylor expanded in z around inf 82.2%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt82.2%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      2. times-frac82.2%

        \[\leadsto x \cdot x - \color{blue}{\frac{y}{\sqrt{\frac{1}{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}}} \]
      3. sqrt-div82.2%

        \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      4. metadata-eval82.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      5. sqrt-pow182.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      6. metadata-eval82.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{{z}^{\color{blue}{1}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. pow182.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. sqrt-div82.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\color{blue}{\frac{\sqrt{1}}{\sqrt{{z}^{2}}}}} \]
      9. metadata-eval82.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      10. sqrt-pow197.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{{z}^{\left(\frac{2}{2}\right)}}}} \]
      11. metadata-eval97.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{{z}^{\color{blue}{1}}}} \]
      12. pow197.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{z}}} \]
    9. Applied egg-rr97.3%

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{z}}} \]
    10. Step-by-step derivation
      1. associate-/r/97.3%

        \[\leadsto x \cdot x - \color{blue}{\left(\frac{y}{1} \cdot z\right)} \cdot \frac{4}{\frac{1}{z}} \]
      2. /-rgt-identity97.3%

        \[\leadsto x \cdot x - \left(\color{blue}{y} \cdot z\right) \cdot \frac{4}{\frac{1}{z}} \]
      3. associate-/r/97.3%

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

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

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

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

Alternative 5: 58.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.45 \cdot 10^{+98}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 1.45000000000000005e98

    1. Initial program 91.8%

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

      \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-*r*44.4%

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} \]
    5. Simplified44.4%

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

    if 1.45000000000000005e98 < (*.f64 x x)

    1. Initial program 85.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 85.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.45 \cdot 10^{+98}:\\ \;\;\;\;y \cdot \left(4 \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 32.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.75 \cdot 10^{+153}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.75e153

    1. Initial program 91.1%

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

      \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-*r*34.6%

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} \]
    5. Simplified34.6%

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

    if 1.75e153 < z

    1. Initial program 77.4%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg77.4%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
      2. flip-+0.0%

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{2}} \cdot \left(z \cdot z\right) - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      4. pow20.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      5. pow-prod-up0.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      6. metadata-eval0.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
      7. pow20.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
    4. Applied egg-rr0.0%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
    5. Step-by-step derivation
      1. clear-num0.0%

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      2. un-div-inv0.0%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
      3. clear-num0.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
      4. metadata-eval0.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      5. pow-prod-up0.0%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
      6. flip-+77.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
      7. unpow277.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
      8. fma-define77.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
      9. add-sqr-sqrt26.8%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
      10. sqrt-prod77.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
      11. sqr-neg77.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
      12. sqrt-prod50.5%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
      13. add-sqr-sqrt77.4%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
    6. Applied egg-rr77.4%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
    7. Taylor expanded in z around 0 33.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{t}}} \]
    8. Taylor expanded in x around 0 18.2%

      \[\leadsto \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
    9. Step-by-step derivation
      1. associate-*r*18.2%

        \[\leadsto \color{blue}{\left(-4 \cdot t\right) \cdot y} \]
      2. metadata-eval18.2%

        \[\leadsto \left(\color{blue}{\left(-4\right)} \cdot t\right) \cdot y \]
      3. distribute-lft-neg-in18.2%

        \[\leadsto \color{blue}{\left(-4 \cdot t\right)} \cdot y \]
      4. metadata-eval18.2%

        \[\leadsto \left(-\color{blue}{\frac{4}{1}} \cdot t\right) \cdot y \]
      5. associate-/r/18.2%

        \[\leadsto \left(-\color{blue}{\frac{4}{\frac{1}{t}}}\right) \cdot y \]
      6. distribute-lft-neg-in18.2%

        \[\leadsto \color{blue}{-\frac{4}{\frac{1}{t}} \cdot y} \]
      7. *-commutative18.2%

        \[\leadsto -\color{blue}{y \cdot \frac{4}{\frac{1}{t}}} \]
      8. distribute-rgt-neg-in18.2%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{4}{\frac{1}{t}}\right)} \]
      9. associate-/r/18.2%

        \[\leadsto y \cdot \left(-\color{blue}{\frac{4}{1} \cdot t}\right) \]
      10. metadata-eval18.2%

        \[\leadsto y \cdot \left(-\color{blue}{4} \cdot t\right) \]
      11. distribute-lft-neg-in18.2%

        \[\leadsto y \cdot \color{blue}{\left(\left(-4\right) \cdot t\right)} \]
      12. metadata-eval18.2%

        \[\leadsto y \cdot \left(\color{blue}{-4} \cdot t\right) \]
    10. Simplified18.2%

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

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

Alternative 7: 66.8% accurate, 1.4× speedup?

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

\\
x \cdot x - -4 \cdot \left(y \cdot t\right)
\end{array}
Derivation
  1. Initial program 89.1%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 66.0%

    \[\leadsto x \cdot x - \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
  4. Step-by-step derivation
    1. *-commutative66.0%

      \[\leadsto x \cdot x - -4 \cdot \color{blue}{\left(y \cdot t\right)} \]
  5. Simplified66.0%

    \[\leadsto x \cdot x - \color{blue}{-4 \cdot \left(y \cdot t\right)} \]
  6. Final simplification66.0%

    \[\leadsto x \cdot x - -4 \cdot \left(y \cdot t\right) \]
  7. Add Preprocessing

Alternative 8: 5.5% accurate, 2.6× speedup?

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

\\
y \cdot \left(t \cdot -4\right)
\end{array}
Derivation
  1. Initial program 89.1%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sub-neg89.1%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)} \]
    2. flip-+54.4%

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

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{2}} \cdot \left(z \cdot z\right) - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
    4. pow254.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{2} \cdot \color{blue}{{z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
    5. pow-prod-up54.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{\color{blue}{{z}^{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
    6. metadata-eval54.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{\color{blue}{4}} - \left(-t\right) \cdot \left(-t\right)}{z \cdot z - \left(-t\right)} \]
    7. pow254.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{\color{blue}{{z}^{2}} - \left(-t\right)} \]
  4. Applied egg-rr54.4%

    \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}} \]
  5. Step-by-step derivation
    1. clear-num54.4%

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{1}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
    2. un-div-inv54.4%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{{z}^{2} - \left(-t\right)}{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}}} \]
    3. clear-num54.4%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{\frac{{z}^{4} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}}} \]
    4. metadata-eval54.4%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{{z}^{\color{blue}{\left(2 + 2\right)}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
    5. pow-prod-up54.4%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\frac{\color{blue}{{z}^{2} \cdot {z}^{2}} - \left(-t\right) \cdot \left(-t\right)}{{z}^{2} - \left(-t\right)}}} \]
    6. flip-+89.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{{z}^{2} + \left(-t\right)}}} \]
    7. unpow289.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{z \cdot z} + \left(-t\right)}} \]
    8. fma-define89.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\color{blue}{\mathsf{fma}\left(z, z, -t\right)}}} \]
    9. add-sqr-sqrt42.7%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)}} \]
    10. sqrt-prod69.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)}} \]
    11. sqr-neg69.0%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)}} \]
    12. sqrt-prod32.2%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)}} \]
    13. add-sqr-sqrt63.3%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, \color{blue}{t}\right)}} \]
  6. Applied egg-rr63.3%

    \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}} \]
  7. Taylor expanded in z around 0 42.8%

    \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{1}{t}}} \]
  8. Taylor expanded in x around 0 6.7%

    \[\leadsto \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
  9. Step-by-step derivation
    1. associate-*r*6.7%

      \[\leadsto \color{blue}{\left(-4 \cdot t\right) \cdot y} \]
    2. metadata-eval6.7%

      \[\leadsto \left(\color{blue}{\left(-4\right)} \cdot t\right) \cdot y \]
    3. distribute-lft-neg-in6.7%

      \[\leadsto \color{blue}{\left(-4 \cdot t\right)} \cdot y \]
    4. metadata-eval6.7%

      \[\leadsto \left(-\color{blue}{\frac{4}{1}} \cdot t\right) \cdot y \]
    5. associate-/r/6.7%

      \[\leadsto \left(-\color{blue}{\frac{4}{\frac{1}{t}}}\right) \cdot y \]
    6. distribute-lft-neg-in6.7%

      \[\leadsto \color{blue}{-\frac{4}{\frac{1}{t}} \cdot y} \]
    7. *-commutative6.7%

      \[\leadsto -\color{blue}{y \cdot \frac{4}{\frac{1}{t}}} \]
    8. distribute-rgt-neg-in6.7%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{4}{\frac{1}{t}}\right)} \]
    9. associate-/r/6.7%

      \[\leadsto y \cdot \left(-\color{blue}{\frac{4}{1} \cdot t}\right) \]
    10. metadata-eval6.7%

      \[\leadsto y \cdot \left(-\color{blue}{4} \cdot t\right) \]
    11. distribute-lft-neg-in6.7%

      \[\leadsto y \cdot \color{blue}{\left(\left(-4\right) \cdot t\right)} \]
    12. metadata-eval6.7%

      \[\leadsto y \cdot \left(\color{blue}{-4} \cdot t\right) \]
  10. Simplified6.7%

    \[\leadsto \color{blue}{y \cdot \left(-4 \cdot t\right)} \]
  11. Final simplification6.7%

    \[\leadsto y \cdot \left(t \cdot -4\right) \]
  12. Add Preprocessing

Developer target: 91.2% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024067 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :alt
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

  (- (* x x) (* (* y 4.0) (- (* z z) t))))