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

Percentage Accurate: 90.2% → 95.9%
Time: 11.9s
Alternatives: 8
Speedup: 0.7×

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: 90.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: 95.9% accurate, 0.6× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - \mathsf{fma}\left(\left(y \cdot 4\right) \cdot z, z, \color{blue}{\left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right)}\right) \]
      9. neg-mul-1N/A

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

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

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

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

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

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

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

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

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

    if 1e308 < (*.f64 x x)

    1. Initial program 79.4%

      \[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. +-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} + 0} \]
      2. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} + 0 \]
      3. accelerator-lowering-fma.f6492.1

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    5. Simplified92.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{x \cdot x} \]
    7. Applied egg-rr92.1%

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

Alternative 2: 59.1% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 96.3%

      \[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. +-rgt-identityN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, 0\right) \]
      8. *-lowering-*.f6462.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, t \cdot 4, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

    if 1e-176 < (*.f64 x x) < 1.5e15

    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 z around inf

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

        \[\leadsto \mathsf{fma}\left(-4, \color{blue}{y \cdot {z}^{2}}, 0\right) \]
      4. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(-4, y \cdot \left(\color{blue}{z \cdot z} + 0\right), 0\right) \]
      6. accelerator-lowering-fma.f6462.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, y \cdot \mathsf{fma}\left(z, z, 0\right), 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left(z \cdot z + 0\right)} \]
      3. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e15 < (*.f64 x x)

    1. Initial program 84.3%

      \[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. +-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} + 0} \]
      2. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} + 0 \]
      3. accelerator-lowering-fma.f6473.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    5. Simplified73.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. *-lowering-*.f6473.9

        \[\leadsto \color{blue}{x \cdot x} \]
    7. Applied egg-rr73.9%

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

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

Alternative 3: 95.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \mathsf{fma}\left(z, z, 0 - t\right)\right)\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) 1e+107)
   (fma x x (* y (* -4.0 (fma z z (- 0.0 t)))))
   (fma (* z (* y -4.0)) z (* x x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 1e+107) {
		tmp = fma(x, x, (y * (-4.0 * fma(z, z, (0.0 - t)))));
	} 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) <= 1e+107)
		tmp = fma(x, x, Float64(y * Float64(-4.0 * fma(z, z, Float64(0.0 - t)))));
	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], 1e+107], N[(x * x + N[(y * N[(-4.0 * N[(z * z + N[(0.0 - t), $MachinePrecision]), $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 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \mathsf{fma}\left(z, z, 0 - t\right)\right)\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) < 9.9999999999999997e106

    1. Initial program 97.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-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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(\mathsf{fma}\left(z, z, \color{blue}{0 - t}\right) \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right) \]
      13. metadata-eval98.7

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

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

    if 9.9999999999999997e106 < (*.f64 z z)

    1. Initial program 81.2%

      \[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 x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{{z}^{2}} \]
    4. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} + 0\right) \]
      3. accelerator-lowering-fma.f6480.3

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

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\mathsf{fma}\left(z, z, 0\right)} \]
    6. 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 + 0\right)\right)\right)} \]
      2. distribute-lft-neg-inN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left(z \cdot z + 0\right)} + x \cdot x \]
      9. +-rgt-identityN/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot -4\right)} \cdot z, z, x \cdot x\right) \]
      15. +-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x + 0}\right) \]
      16. accelerator-lowering-fma.f6492.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \mathsf{fma}\left(x, x, 0\right)\right)} \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x}\right) \]
    9. Applied egg-rr92.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 simplification96.5%

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

Alternative 4: 90.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(x, x, 4 \cdot \left(y \cdot t\right)\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) 1e+107)
   (fma x x (* 4.0 (* y t)))
   (fma (* z (* y -4.0)) z (* x x))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 1e+107) {
		tmp = fma(x, x, (4.0 * (y * t)));
	} 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) <= 1e+107)
		tmp = fma(x, x, Float64(4.0 * Float64(y * t)));
	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], 1e+107], N[(x * x + N[(4.0 * N[(y * t), $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 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(x, x, 4 \cdot \left(y \cdot t\right)\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) < 9.9999999999999997e106

    1. Initial program 97.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-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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(\mathsf{fma}\left(z, z, \color{blue}{0 - t}\right) \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right) \]
      13. metadata-eval98.7

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

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

      \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{4 \cdot \left(t \cdot y\right)}\right) \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\mathsf{fma}\left(t, y \cdot 4, 0\right)}\right) \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

    if 9.9999999999999997e106 < (*.f64 z z)

    1. Initial program 81.2%

      \[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 x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{{z}^{2}} \]
    4. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} + 0\right) \]
      3. accelerator-lowering-fma.f6480.3

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

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\mathsf{fma}\left(z, z, 0\right)} \]
    6. 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 + 0\right)\right)\right)} \]
      2. distribute-lft-neg-inN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left(z \cdot z + 0\right)} + x \cdot x \]
      9. +-rgt-identityN/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y \cdot -4\right)} \cdot z, z, x \cdot x\right) \]
      15. +-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x + 0}\right) \]
      16. accelerator-lowering-fma.f6492.6

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \mathsf{fma}\left(x, x, 0\right)\right)} \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \color{blue}{x \cdot x}\right) \]
    9. Applied egg-rr92.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 simplification92.2%

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

Alternative 5: 85.3% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 97.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 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. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(y, t \cdot 4, \color{blue}{x \cdot x} + 0\right) \]
      11. accelerator-lowering-fma.f6491.4

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

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

    if 1.9999999999999999e159 < (*.f64 z z)

    1. Initial program 81.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. +-rgt-identityN/A

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

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

        \[\leadsto \mathsf{fma}\left(-4, \color{blue}{y \cdot {z}^{2}}, 0\right) \]
      4. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(-4, y \cdot \left(\color{blue}{z \cdot z} + 0\right), 0\right) \]
      6. accelerator-lowering-fma.f6479.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, y \cdot \mathsf{fma}\left(z, z, 0\right), 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left(z \cdot z + 0\right)} \]
      3. +-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 6: 85.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.0%

      \[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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(\mathsf{fma}\left(z, z, \color{blue}{0 - t}\right) \cdot \left(\mathsf{neg}\left(4\right)\right)\right)\right) \]
      13. metadata-eval98.2

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

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

      \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{4 \cdot \left(t \cdot y\right)}\right) \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \mathsf{fma}\left(t, \color{blue}{y \cdot 4}, 0\right)\right) \]
    7. Simplified90.2%

      \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\mathsf{fma}\left(t, y \cdot 4, 0\right)}\right) \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

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

    if 1.9999999999999999e159 < (*.f64 z z)

    1. Initial program 81.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. +-rgt-identityN/A

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

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

        \[\leadsto \mathsf{fma}\left(-4, \color{blue}{y \cdot {z}^{2}}, 0\right) \]
      4. +-rgt-identityN/A

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

        \[\leadsto \mathsf{fma}\left(-4, y \cdot \left(\color{blue}{z \cdot z} + 0\right), 0\right) \]
      6. accelerator-lowering-fma.f6479.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, y \cdot \mathsf{fma}\left(z, z, 0\right), 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left(z \cdot z + 0\right)} \]
      3. +-rgt-identityN/A

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

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

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

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

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

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

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

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

Alternative 7: 58.2% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 96.3%

      \[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. +-rgt-identityN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t \cdot 4}, 0\right) \]
      8. *-lowering-*.f6454.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, t \cdot 4, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

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

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

    if 2.0000000000000001e97 < (*.f64 x x)

    1. Initial program 84.0%

      \[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. +-rgt-identityN/A

        \[\leadsto \color{blue}{{x}^{2} + 0} \]
      2. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} + 0 \]
      3. accelerator-lowering-fma.f6480.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    5. Simplified80.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. *-lowering-*.f6480.0

        \[\leadsto \color{blue}{x \cdot x} \]
    7. Applied egg-rr80.0%

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

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

Alternative 8: 41.1% 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 91.6%

    \[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. +-rgt-identityN/A

      \[\leadsto \color{blue}{{x}^{2} + 0} \]
    2. unpow2N/A

      \[\leadsto \color{blue}{x \cdot x} + 0 \]
    3. accelerator-lowering-fma.f6438.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
  5. Simplified38.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 0\right)} \]
  6. Step-by-step derivation
    1. +-rgt-identityN/A

      \[\leadsto \color{blue}{x \cdot x} \]
    2. *-lowering-*.f6438.8

      \[\leadsto \color{blue}{x \cdot x} \]
  7. Applied egg-rr38.8%

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

Developer Target 1: 90.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 2024196 
(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))))