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

Percentage Accurate: 90.9% → 97.6%
Time: 11.1s
Alternatives: 11
Speedup: 0.8×

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 11 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: 90.9% 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: 97.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right) \cdot \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)}{x \cdot x + \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}} \]
      2. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right) \cdot \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right) \cdot \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)}}} \]
      4. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right) \cdot \left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)}{x \cdot x + \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}}}} \]
      5. flip--N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}}} \]
      6. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}}} \]
      7. sub-negN/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot x + \left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right)}}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right) + x \cdot x}}} \]
    4. Applied egg-rr99.2%

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

    if 2.0000000000000002e302 < (*.f64 z z)

    1. Initial program 64.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-negN/A

        \[\leadsto \color{blue}{x \cdot x + \left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right) + x \cdot x} \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)} + x \cdot x \]
      4. sub-negN/A

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

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
      6. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      7. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot z} + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z}, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot \color{blue}{-4}\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \left(\mathsf{neg}\left(\color{blue}{4 \cdot y}\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      14. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      15. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x\right) \]
      16. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{{x}^{2}}\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x}\right) \]
      2. *-lowering-*.f6496.6

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

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

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

Alternative 2: 62.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\ t_2 := \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\ t_3 := y \cdot \left(t \cdot 4\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+303}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq -4 \cdot 10^{+120}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+141}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (* z y) (* z -4.0)))
        (t_2 (* (* y 4.0) (- (* z z) t)))
        (t_3 (* y (* t 4.0))))
   (if (<= t_2 -5e+303)
     t_1
     (if (<= t_2 -4e+120)
       t_3
       (if (<= t_2 5e+141) (* x x) (if (<= t_2 2e+305) t_3 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * y) * (z * -4.0);
	double t_2 = (y * 4.0) * ((z * z) - t);
	double t_3 = y * (t * 4.0);
	double tmp;
	if (t_2 <= -5e+303) {
		tmp = t_1;
	} else if (t_2 <= -4e+120) {
		tmp = t_3;
	} else if (t_2 <= 5e+141) {
		tmp = x * x;
	} else if (t_2 <= 2e+305) {
		tmp = t_3;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = (z * y) * (z * (-4.0d0))
    t_2 = (y * 4.0d0) * ((z * z) - t)
    t_3 = y * (t * 4.0d0)
    if (t_2 <= (-5d+303)) then
        tmp = t_1
    else if (t_2 <= (-4d+120)) then
        tmp = t_3
    else if (t_2 <= 5d+141) then
        tmp = x * x
    else if (t_2 <= 2d+305) then
        tmp = t_3
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (z * y) * (z * -4.0);
	double t_2 = (y * 4.0) * ((z * z) - t);
	double t_3 = y * (t * 4.0);
	double tmp;
	if (t_2 <= -5e+303) {
		tmp = t_1;
	} else if (t_2 <= -4e+120) {
		tmp = t_3;
	} else if (t_2 <= 5e+141) {
		tmp = x * x;
	} else if (t_2 <= 2e+305) {
		tmp = t_3;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * y) * (z * -4.0)
	t_2 = (y * 4.0) * ((z * z) - t)
	t_3 = y * (t * 4.0)
	tmp = 0
	if t_2 <= -5e+303:
		tmp = t_1
	elif t_2 <= -4e+120:
		tmp = t_3
	elif t_2 <= 5e+141:
		tmp = x * x
	elif t_2 <= 2e+305:
		tmp = t_3
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * y) * Float64(z * -4.0))
	t_2 = Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))
	t_3 = Float64(y * Float64(t * 4.0))
	tmp = 0.0
	if (t_2 <= -5e+303)
		tmp = t_1;
	elseif (t_2 <= -4e+120)
		tmp = t_3;
	elseif (t_2 <= 5e+141)
		tmp = Float64(x * x);
	elseif (t_2 <= 2e+305)
		tmp = t_3;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * y) * (z * -4.0);
	t_2 = (y * 4.0) * ((z * z) - t);
	t_3 = y * (t * 4.0);
	tmp = 0.0;
	if (t_2 <= -5e+303)
		tmp = t_1;
	elseif (t_2 <= -4e+120)
		tmp = t_3;
	elseif (t_2 <= 5e+141)
		tmp = x * x;
	elseif (t_2 <= 2e+305)
		tmp = t_3;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+303], t$95$1, If[LessEqual[t$95$2, -4e+120], t$95$3, If[LessEqual[t$95$2, 5e+141], N[(x * x), $MachinePrecision], If[LessEqual[t$95$2, 2e+305], t$95$3, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\
t_2 := \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\
t_3 := y \cdot \left(t \cdot 4\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+303}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{+120}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+141}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -4.9999999999999997e303 or 1.9999999999999999e305 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))

    1. Initial program 73.0%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(-4 \cdot {z}^{2}\right)} \]
      6. unpow2N/A

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      7. *-lowering-*.f6461.9

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

      \[\leadsto \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right) \cdot \left(z \cdot z\right)} \]
      2. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(y \cdot -4\right) \cdot z\right) \cdot z} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(\left(y \cdot -4\right) \cdot z\right)} \]
      4. associate-*l*N/A

        \[\leadsto z \cdot \color{blue}{\left(y \cdot \left(-4 \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(-4 \cdot z\right) \]
      8. *-lowering-*.f6476.5

        \[\leadsto \left(z \cdot y\right) \cdot \color{blue}{\left(-4 \cdot z\right)} \]
    7. Applied egg-rr76.5%

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

    if -4.9999999999999997e303 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -3.9999999999999999e120 or 5.00000000000000025e141 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 1.9999999999999999e305

    1. Initial program 99.9%

      \[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

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

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(t \cdot 4\right)} \]
      5. *-lowering-*.f6465.5

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

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

    if -3.9999999999999999e120 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 5.00000000000000025e141

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. *-lowering-*.f6466.7

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

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

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

Alternative 3: 59.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t \cdot 4\right)\\ t_2 := \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\ t_3 := y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+303}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq -4 \cdot 10^{+120}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+141}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (* t 4.0)))
        (t_2 (* (* y 4.0) (- (* z z) t)))
        (t_3 (* y (* (* z z) -4.0))))
   (if (<= t_2 -5e+303)
     t_3
     (if (<= t_2 -4e+120)
       t_1
       (if (<= t_2 5e+141) (* x x) (if (<= t_2 2e+305) t_1 t_3))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t * 4.0);
	double t_2 = (y * 4.0) * ((z * z) - t);
	double t_3 = y * ((z * z) * -4.0);
	double tmp;
	if (t_2 <= -5e+303) {
		tmp = t_3;
	} else if (t_2 <= -4e+120) {
		tmp = t_1;
	} else if (t_2 <= 5e+141) {
		tmp = x * x;
	} else if (t_2 <= 2e+305) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = y * (t * 4.0d0)
    t_2 = (y * 4.0d0) * ((z * z) - t)
    t_3 = y * ((z * z) * (-4.0d0))
    if (t_2 <= (-5d+303)) then
        tmp = t_3
    else if (t_2 <= (-4d+120)) then
        tmp = t_1
    else if (t_2 <= 5d+141) then
        tmp = x * x
    else if (t_2 <= 2d+305) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (t * 4.0);
	double t_2 = (y * 4.0) * ((z * z) - t);
	double t_3 = y * ((z * z) * -4.0);
	double tmp;
	if (t_2 <= -5e+303) {
		tmp = t_3;
	} else if (t_2 <= -4e+120) {
		tmp = t_1;
	} else if (t_2 <= 5e+141) {
		tmp = x * x;
	} else if (t_2 <= 2e+305) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t * 4.0)
	t_2 = (y * 4.0) * ((z * z) - t)
	t_3 = y * ((z * z) * -4.0)
	tmp = 0
	if t_2 <= -5e+303:
		tmp = t_3
	elif t_2 <= -4e+120:
		tmp = t_1
	elif t_2 <= 5e+141:
		tmp = x * x
	elif t_2 <= 2e+305:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t * 4.0))
	t_2 = Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))
	t_3 = Float64(y * Float64(Float64(z * z) * -4.0))
	tmp = 0.0
	if (t_2 <= -5e+303)
		tmp = t_3;
	elseif (t_2 <= -4e+120)
		tmp = t_1;
	elseif (t_2 <= 5e+141)
		tmp = Float64(x * x);
	elseif (t_2 <= 2e+305)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t * 4.0);
	t_2 = (y * 4.0) * ((z * z) - t);
	t_3 = y * ((z * z) * -4.0);
	tmp = 0.0;
	if (t_2 <= -5e+303)
		tmp = t_3;
	elseif (t_2 <= -4e+120)
		tmp = t_1;
	elseif (t_2 <= 5e+141)
		tmp = x * x;
	elseif (t_2 <= 2e+305)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+303], t$95$3, If[LessEqual[t$95$2, -4e+120], t$95$1, If[LessEqual[t$95$2, 5e+141], N[(x * x), $MachinePrecision], If[LessEqual[t$95$2, 2e+305], t$95$1, t$95$3]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(t \cdot 4\right)\\
t_2 := \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\
t_3 := y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+303}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+141}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -4.9999999999999997e303 or 1.9999999999999999e305 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))

    1. Initial program 73.0%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(-4 \cdot {z}^{2}\right)} \]
      6. unpow2N/A

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      7. *-lowering-*.f6461.9

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

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

    if -4.9999999999999997e303 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -3.9999999999999999e120 or 5.00000000000000025e141 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 1.9999999999999999e305

    1. Initial program 99.9%

      \[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

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

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(t \cdot 4\right)} \]
      5. *-lowering-*.f6465.5

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

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

    if -3.9999999999999999e120 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 5.00000000000000025e141

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. *-lowering-*.f6466.7

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

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

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

Alternative 4: 89.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-43}:\\ \;\;\;\;\mathsf{fma}\left(y, t \cdot 4, x \cdot x\right)\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+269}:\\ \;\;\;\;\mathsf{fma}\left(y, \left(z \cdot z\right) \cdot -4, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\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-43)
   (fma y (* t 4.0) (* x x))
   (if (<= (* z z) 2e+269)
     (fma y (* (* z z) -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-43) {
		tmp = fma(y, (t * 4.0), (x * x));
	} else if ((z * z) <= 2e+269) {
		tmp = fma(y, ((z * z) * -4.0), (x * x));
	} else {
		tmp = (z * y) * (z * -4.0);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 5e-43)
		tmp = fma(y, Float64(t * 4.0), Float64(x * x));
	elseif (Float64(z * z) <= 2e+269)
		tmp = fma(y, Float64(Float64(z * z) * -4.0), Float64(x * x));
	else
		tmp = Float64(Float64(z * y) * Float64(z * -4.0));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-43], N[(y * N[(t * 4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+269], N[(y * N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+269}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(z \cdot z\right) \cdot -4, x \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 5.00000000000000019e-43

    1. Initial program 98.4%

      \[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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{4} \cdot \left(t \cdot y\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right) + {x}^{2}} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} + {x}^{2} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} + {x}^{2} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 4 \cdot t, {x}^{2}\right)} \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
      10. *-lowering-*.f6495.3

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

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

    if 5.00000000000000019e-43 < (*.f64 z z) < 2.0000000000000001e269

    1. Initial program 96.7%

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

      \[\leadsto \color{blue}{{x}^{2} - 4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot {z}^{2}\right)} \]
      2. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{-4} \cdot \left(y \cdot {z}^{2}\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right) + {x}^{2}} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} + {x}^{2} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} + {x}^{2} \]
      6. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} + {x}^{2} \]
      7. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, -4 \cdot {z}^{2}, {x}^{2}\right)} \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-4 \cdot {z}^{2}}, {x}^{2}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(y, -4 \cdot \color{blue}{\left(z \cdot z\right)}, {x}^{2}\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, -4 \cdot \color{blue}{\left(z \cdot z\right)}, {x}^{2}\right) \]
      11. unpow2N/A

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

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

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

    if 2.0000000000000001e269 < (*.f64 z z)

    1. Initial program 66.8%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(-4 \cdot {z}^{2}\right)} \]
      6. unpow2N/A

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      7. *-lowering-*.f6468.5

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

      \[\leadsto \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right) \cdot \left(z \cdot z\right)} \]
      2. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(y \cdot -4\right) \cdot z\right) \cdot z} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(\left(y \cdot -4\right) \cdot z\right)} \]
      4. associate-*l*N/A

        \[\leadsto z \cdot \color{blue}{\left(y \cdot \left(-4 \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(-4 \cdot z\right) \]
      8. *-lowering-*.f6489.7

        \[\leadsto \left(z \cdot y\right) \cdot \color{blue}{\left(-4 \cdot z\right)} \]
    7. Applied egg-rr89.7%

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

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

Alternative 5: 86.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+43}:\\ \;\;\;\;\mathsf{fma}\left(y, t \cdot 4, x \cdot x\right)\\ \mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+302}:\\ \;\;\;\;-4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\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) 2e+43)
   (fma y (* t 4.0) (* x x))
   (if (<= (* z z) 2e+302)
     (* -4.0 (* y (- (* z z) t)))
     (* (* z y) (* z -4.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 2e+43) {
		tmp = fma(y, (t * 4.0), (x * x));
	} else if ((z * z) <= 2e+302) {
		tmp = -4.0 * (y * ((z * z) - t));
	} else {
		tmp = (z * y) * (z * -4.0);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 2e+43)
		tmp = fma(y, Float64(t * 4.0), Float64(x * x));
	elseif (Float64(z * z) <= 2e+302)
		tmp = Float64(-4.0 * Float64(y * Float64(Float64(z * z) - t)));
	else
		tmp = Float64(Float64(z * y) * Float64(z * -4.0));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+43], N[(y * N[(t * 4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+302], N[(-4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+302}:\\
\;\;\;\;-4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\\

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


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

    1. Initial program 98.5%

      \[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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{4} \cdot \left(t \cdot y\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right) + {x}^{2}} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} + {x}^{2} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} + {x}^{2} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 4 \cdot t, {x}^{2}\right)} \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
      10. *-lowering-*.f6494.4

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
    5. Simplified94.4%

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

    if 2.00000000000000003e43 < (*.f64 z z) < 2.0000000000000002e302

    1. Initial program 96.2%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      2. *-lowering-*.f64N/A

        \[\leadsto -4 \cdot \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right)} \]
      3. --lowering--.f64N/A

        \[\leadsto -4 \cdot \left(y \cdot \color{blue}{\left({z}^{2} - t\right)}\right) \]
      4. unpow2N/A

        \[\leadsto -4 \cdot \left(y \cdot \left(\color{blue}{z \cdot z} - t\right)\right) \]
      5. *-lowering-*.f6473.8

        \[\leadsto -4 \cdot \left(y \cdot \left(\color{blue}{z \cdot z} - t\right)\right) \]
    5. Simplified73.8%

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

    if 2.0000000000000002e302 < (*.f64 z z)

    1. Initial program 64.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 inf

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(-4 \cdot {z}^{2}\right)} \]
      6. unpow2N/A

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      7. *-lowering-*.f6467.4

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

      \[\leadsto \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right) \cdot \left(z \cdot z\right)} \]
      2. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(y \cdot -4\right) \cdot z\right) \cdot z} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(\left(y \cdot -4\right) \cdot z\right)} \]
      4. associate-*l*N/A

        \[\leadsto z \cdot \color{blue}{\left(y \cdot \left(-4 \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(-4 \cdot z\right) \]
      8. *-lowering-*.f6490.3

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

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

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

Alternative 6: 96.9% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 97.9%

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

    if 2.0000000000000002e302 < (*.f64 z z)

    1. Initial program 64.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-negN/A

        \[\leadsto \color{blue}{x \cdot x + \left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right) + x \cdot x} \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)} + x \cdot x \]
      4. sub-negN/A

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

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
      6. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      7. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot z} + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z}, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot \color{blue}{-4}\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \left(\mathsf{neg}\left(\color{blue}{4 \cdot y}\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      14. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      15. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x\right) \]
      16. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{{x}^{2}}\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x}\right) \]
      2. *-lowering-*.f6496.6

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

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

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

Alternative 7: 94.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(z \cdot \left(y \cdot -4\right), z, \mathsf{fma}\left(-4, y \cdot \left(-t\right), x \cdot x\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (fma (* z (* y -4.0)) z (fma -4.0 (* y (- t)) (* x x))))
double code(double x, double y, double z, double t) {
	return fma((z * (y * -4.0)), z, fma(-4.0, (y * -t), (x * x)));
}
function code(x, y, z, t)
	return fma(Float64(z * Float64(y * -4.0)), z, fma(-4.0, Float64(y * Float64(-t)), Float64(x * x)))
end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision] * z + N[(-4.0 * N[(y * (-t)), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(z \cdot \left(y \cdot -4\right), z, \mathsf{fma}\left(-4, y \cdot \left(-t\right), x \cdot x\right)\right)
\end{array}
Derivation
  1. Initial program 89.8%

    \[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-negN/A

      \[\leadsto \color{blue}{x \cdot x + \left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right)} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right) + x \cdot x} \]
    3. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)} + x \cdot x \]
    4. sub-negN/A

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

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
    6. associate-+l+N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
    7. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot z} + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    8. accelerator-lowering-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z}, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    10. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\left(y \cdot \color{blue}{-4}\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \left(\mathsf{neg}\left(\color{blue}{4 \cdot y}\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    14. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
    15. associate-*l*N/A

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x\right) \]
    16. accelerator-lowering-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(4\right), y \cdot \left(\mathsf{neg}\left(t\right)\right), x \cdot x\right)}\right) \]
  4. Applied egg-rr96.8%

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

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

Alternative 8: 91.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 5.00000000000000019e-43

    1. Initial program 98.4%

      \[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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{4} \cdot \left(t \cdot y\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right) + {x}^{2}} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} + {x}^{2} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} + {x}^{2} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 4 \cdot t, {x}^{2}\right)} \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
      10. *-lowering-*.f6495.3

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

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

    if 5.00000000000000019e-43 < (*.f64 z z)

    1. Initial program 81.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-negN/A

        \[\leadsto \color{blue}{x \cdot x + \left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)\right) + x \cdot x} \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)} + x \cdot x \]
      4. sub-negN/A

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

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
      6. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      7. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot z} + \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      8. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right)} \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z}, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right)} \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot \color{blue}{-4}\right) \cdot z, z, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \left(\mathsf{neg}\left(\color{blue}{4 \cdot y}\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      14. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right) + x \cdot x\right) \]
      15. associate-*l*N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{\left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x\right) \]
      16. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{{x}^{2}}\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x}\right) \]
      2. *-lowering-*.f6492.5

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

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

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

Alternative 9: 84.1% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\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) < 2.00000000000000003e43

    1. Initial program 98.5%

      \[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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{4} \cdot \left(t \cdot y\right) \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right) + {x}^{2}} \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} + {x}^{2} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} + {x}^{2} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 4 \cdot t, {x}^{2}\right)} \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, {x}^{2}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
      10. *-lowering-*.f6494.4

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x}\right) \]
    5. Simplified94.4%

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

    if 2.00000000000000003e43 < (*.f64 z z)

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot {z}^{2}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right)} \cdot {z}^{2} \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(-4 \cdot {z}^{2}\right)} \]
      5. *-lowering-*.f64N/A

        \[\leadsto y \cdot \color{blue}{\left(-4 \cdot {z}^{2}\right)} \]
      6. unpow2N/A

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      7. *-lowering-*.f6465.7

        \[\leadsto y \cdot \left(-4 \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
    5. Simplified65.7%

      \[\leadsto \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(y \cdot -4\right) \cdot \left(z \cdot z\right)} \]
      2. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(y \cdot -4\right) \cdot z\right) \cdot z} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{z \cdot \left(\left(y \cdot -4\right) \cdot z\right)} \]
      4. associate-*l*N/A

        \[\leadsto z \cdot \color{blue}{\left(y \cdot \left(-4 \cdot z\right)\right)} \]
      5. associate-*r*N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(z \cdot y\right)} \cdot \left(-4 \cdot z\right) \]
      8. *-lowering-*.f6477.7

        \[\leadsto \left(z \cdot y\right) \cdot \color{blue}{\left(-4 \cdot z\right)} \]
    7. Applied egg-rr77.7%

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

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

Alternative 10: 46.1% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{-19}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.80000000000000003e-19

    1. Initial program 90.5%

      \[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

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

        \[\leadsto \color{blue}{\left(4 \cdot t\right) \cdot y} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(4 \cdot t\right)} \]
      4. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(t \cdot 4\right)} \]
      5. *-lowering-*.f6434.0

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

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

    if 2.80000000000000003e-19 < x

    1. Initial program 87.7%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. *-lowering-*.f6471.1

        \[\leadsto \color{blue}{x \cdot x} \]
    5. Simplified71.1%

      \[\leadsto \color{blue}{x \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 41.2% accurate, 4.5× speedup?

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

\\
x \cdot x
\end{array}
Derivation
  1. Initial program 89.8%

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

    \[\leadsto \color{blue}{{x}^{2}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{x \cdot x} \]
    2. *-lowering-*.f6440.1

      \[\leadsto \color{blue}{x \cdot x} \]
  5. Simplified40.1%

    \[\leadsto \color{blue}{x \cdot x} \]
  6. Add Preprocessing

Developer Target 1: 90.9% 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 2024199 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :alt
  (! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))

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