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

Percentage Accurate: 90.8% → 97.7%
Time: 10.8s
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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 98.9%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000031e289 < (*.f64 z z)

    1. Initial program 70.7%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{\frac{y \cdot 4}{1}}\right)\right) \cdot z, z, x \cdot x\right) \]
      5. distribute-neg-frac2N/A

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{-1}{y \cdot 4}}} \cdot z, z, x \cdot x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{-1}{y \cdot 4}}} \cdot z, z, x \cdot x\right) \]
      9. lower-/.f6495.6

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{-1}{y \cdot 4}}} \cdot z, z, x \cdot x\right) \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z \cdot \frac{1}{\color{blue}{\frac{-1}{y \cdot 4}}}, z, x \cdot x\right) \]
      14. un-div-invN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z}{\frac{-1}{y \cdot 4}}}, z, x \cdot x\right) \]
      15. lower-/.f6495.6

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z}{\frac{-1}{y \cdot 4}}}, z, x \cdot x\right) \]
      16. lift-/.f64N/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{z}{\color{blue}{\frac{\frac{-1}{4}}{y}}}, z, x \cdot x\right) \]
      20. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{z}{\color{blue}{\frac{\frac{-1}{4}}{y}}}, z, x \cdot x\right) \]
      21. metadata-eval95.6

        \[\leadsto \mathsf{fma}\left(\frac{z}{\frac{\color{blue}{-0.25}}{y}}, z, x \cdot x\right) \]
    11. Applied egg-rr95.6%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{z}{\frac{-0.25}{y}}}, z, x \cdot x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 85.0% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 94.8%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5999999999999999e34 < (*.f64 x x) < 1.45e272

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.45e272 < (*.f64 x x)

    1. Initial program 82.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. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6493.7

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

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

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

Alternative 3: 46.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t \cdot 4\right)\\ \mathbf{if}\;z \leq 9.5 \cdot 10^{-231}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (* t 4.0))))
   (if (<= z 9.5e-231)
     t_1
     (if (<= z 1.9e-169)
       (* x x)
       (if (<= z 2.8e-114)
         t_1
         (if (<= z 1.18e-5) (* x x) (* (* z y) (* z -4.0))))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t * 4.0);
	double tmp;
	if (z <= 9.5e-231) {
		tmp = t_1;
	} else if (z <= 1.9e-169) {
		tmp = x * x;
	} else if (z <= 2.8e-114) {
		tmp = t_1;
	} else if (z <= 1.18e-5) {
		tmp = x * x;
	} else {
		tmp = (z * y) * (z * -4.0);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (t * 4.0d0)
    if (z <= 9.5d-231) then
        tmp = t_1
    else if (z <= 1.9d-169) then
        tmp = x * x
    else if (z <= 2.8d-114) then
        tmp = t_1
    else if (z <= 1.18d-5) then
        tmp = x * x
    else
        tmp = (z * y) * (z * (-4.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (t * 4.0);
	double tmp;
	if (z <= 9.5e-231) {
		tmp = t_1;
	} else if (z <= 1.9e-169) {
		tmp = x * x;
	} else if (z <= 2.8e-114) {
		tmp = t_1;
	} else if (z <= 1.18e-5) {
		tmp = x * x;
	} else {
		tmp = (z * y) * (z * -4.0);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t * 4.0)
	tmp = 0
	if z <= 9.5e-231:
		tmp = t_1
	elif z <= 1.9e-169:
		tmp = x * x
	elif z <= 2.8e-114:
		tmp = t_1
	elif z <= 1.18e-5:
		tmp = x * x
	else:
		tmp = (z * y) * (z * -4.0)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t * 4.0))
	tmp = 0.0
	if (z <= 9.5e-231)
		tmp = t_1;
	elseif (z <= 1.9e-169)
		tmp = Float64(x * x);
	elseif (z <= 2.8e-114)
		tmp = t_1;
	elseif (z <= 1.18e-5)
		tmp = Float64(x * x);
	else
		tmp = Float64(Float64(z * y) * Float64(z * -4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t * 4.0);
	tmp = 0.0;
	if (z <= 9.5e-231)
		tmp = t_1;
	elseif (z <= 1.9e-169)
		tmp = x * x;
	elseif (z <= 2.8e-114)
		tmp = t_1;
	elseif (z <= 1.18e-5)
		tmp = x * x;
	else
		tmp = (z * y) * (z * -4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.5e-231], t$95$1, If[LessEqual[z, 1.9e-169], N[(x * x), $MachinePrecision], If[LessEqual[z, 2.8e-114], t$95$1, If[LessEqual[z, 1.18e-5], N[(x * x), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\
\;\;\;\;x \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 9.4999999999999995e-231 or 1.9e-169 < z < 2.8000000000000001e-114

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

    if 9.4999999999999995e-231 < z < 1.9e-169 or 2.8000000000000001e-114 < z < 1.18000000000000005e-5

    1. Initial program 100.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. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6466.8

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

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

    if 1.18000000000000005e-5 < z

    1. Initial program 85.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot z\right)} \cdot \left(-4 \cdot z\right) \]
      11. lower-*.f6470.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9.5 \cdot 10^{-231}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 45.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\
\;\;\;\;x \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 9.4999999999999995e-231 or 1.9e-169 < z < 2.8000000000000001e-114

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

    if 9.4999999999999995e-231 < z < 1.9e-169 or 2.8000000000000001e-114 < z < 1.18000000000000005e-5

    1. Initial program 100.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. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6466.8

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

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

    if 1.18000000000000005e-5 < z

    1. Initial program 85.8%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 9.5 \cdot 10^{-231}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 98.9%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e280 < (*.f64 z z)

    1. Initial program 71.9%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.7% accurate, 0.8× speedup?

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

    1. Initial program 94.8%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5999999999999999e34 < (*.f64 x x)

    1. Initial program 86.8%

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

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 79.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 94.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. lift-*.f64N/A

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      6. 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)} \]
      7. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.7999999999999996e230 < (*.f64 x x)

    1. Initial program 83.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. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6491.3

        \[\leadsto \color{blue}{x \cdot x} \]
    5. Simplified91.3%

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

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

Alternative 8: 79.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 94.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. associate-*r*N/A

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

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

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

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

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

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

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

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

    if 7.7999999999999996e230 < (*.f64 x x)

    1. Initial program 83.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. unpow2N/A

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6491.3

        \[\leadsto \color{blue}{x \cdot x} \]
    5. Simplified91.3%

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

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

Alternative 9: 59.3% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

    if 1.5999999999999999e34 < (*.f64 x x)

    1. Initial program 86.8%

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

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

        \[\leadsto \color{blue}{x \cdot x} \]
      2. lower-*.f6470.9

        \[\leadsto \color{blue}{x \cdot x} \]
    5. Simplified70.9%

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

Alternative 10: 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.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. unpow2N/A

      \[\leadsto \color{blue}{x \cdot x} \]
    2. lower-*.f6439.7

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

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

Developer Target 1: 90.9% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2024207 
(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))))