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

Percentage Accurate: 90.7% → 95.3%
Time: 11.2s
Alternatives: 10
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 10 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.7% 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.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+284}:\\ \;\;\;\;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) 5e+284)
   (- (* 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) <= 5e+284) {
		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) <= 5e+284)
		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], 5e+284], 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 5 \cdot 10^{+284}:\\
\;\;\;\;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) < 4.9999999999999999e284

    1. Initial program 93.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 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-eval97.8

        \[\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-rr97.8%

      \[\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 4.9999999999999999e284 < (*.f64 x x)

    1. Initial program 82.5%

      \[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.f6495.2

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

      \[\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-*.f6495.2

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

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

Alternative 2: 92.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5000000000000001e151 < z

    1. Initial program 68.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 98.3%

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

    if 1.00000000000000005e301 < (*.f64 z z)

    1. Initial program 69.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 84.5% accurate, 0.7× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999999e202 < (*.f64 x x)

    1. Initial program 87.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.9

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

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

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

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

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

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

Alternative 5: 49.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{if}\;x \leq 8.2 \cdot 10^{-224}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 7.5 \cdot 10^{-122}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\

\mathbf{elif}\;x \leq 3 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 8.19999999999999972e-224 or 7.4999999999999998e-122 < x < 2.99999999999999993e101

    1. Initial program 88.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.f6444.8

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

      \[\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. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

    if 8.19999999999999972e-224 < x < 7.4999999999999998e-122

    1. Initial program 95.6%

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

      \[\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.f6476.9

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

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

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

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

        \[\leadsto 4 \cdot \color{blue}{\left(t \cdot y\right)} \]
    8. Simplified68.2%

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

    if 2.99999999999999993e101 < x

    1. Initial program 94.1%

      \[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.f6490.4

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

      \[\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-*.f6490.4

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

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

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

Alternative 6: 47.2% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 8.8 \cdot 10^{-104}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\

\mathbf{elif}\;x \leq 4 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 2.00000000000000003e-221 or 8.80000000000000047e-104 < x < 3.9999999999999999e101

    1. Initial program 88.6%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Taylor expanded in z around 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.f6445.7

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

      \[\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. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

      \[\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 \left(-4 \cdot z\right)\right)} \cdot z \]
      2. associate-*l*N/A

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

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

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

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

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

    if 2.00000000000000003e-221 < x < 8.80000000000000047e-104

    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 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.f6480.6

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

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

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

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

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

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

    if 3.9999999999999999e101 < x

    1. Initial program 94.1%

      \[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.f6490.4

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

      \[\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-*.f6490.4

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

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

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

Alternative 7: 82.9% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 94.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y \cdot 4}{\frac{-1}{\left(z \cdot z + 0\right) - t}}} \]
      8. div-invN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\left(z \cdot z + 0\right) - t}{-1} \cdot \left(y \cdot 4\right)} \]
    9. Applied egg-rr88.7%

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

    if 3.9999999999999998e-7 < (*.f64 x x)

    1. Initial program 86.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 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.f6480.8

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

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

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

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

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

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

Alternative 8: 84.9% accurate, 1.0× speedup?

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

    1. Initial program 98.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.f6485.3

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

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

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

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

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

    if 9.9999999999999995e196 < (*.f64 z z)

    1. Initial program 77.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.f6473.0

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

      \[\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. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 45.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 95000:\\ \;\;\;\;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 95000.0) (* 4.0 (* y t)) (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= 95000.0) {
		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 <= 95000.0d0) 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 <= 95000.0) {
		tmp = 4.0 * (y * t);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= 95000.0:
		tmp = 4.0 * (y * t)
	else:
		tmp = x * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= 95000.0)
		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 <= 95000.0)
		tmp = 4.0 * (y * t);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, 95000.0], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 95000:\\
\;\;\;\;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 x < 95000

    1. Initial program 90.6%

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

      \[\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.f6462.2

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

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

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

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

        \[\leadsto 4 \cdot \color{blue}{\left(t \cdot y\right)} \]
    8. Simplified40.9%

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

    if 95000 < x

    1. Initial program 90.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.f6476.3

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

      \[\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-*.f6476.3

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

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

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

Alternative 10: 41.3% 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 90.5%

    \[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.f6440.3

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

    \[\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-*.f6440.3

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

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

Developer Target 1: 90.7% 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 2024195 
(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))))