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

Percentage Accurate: 90.9% → 97.9%
Time: 7.9s
Alternatives: 9
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 90.9% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 98.9%

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

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

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

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

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

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

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

    if 5.00000000000000023e247 < (*.f64 z z)

    1. Initial program 74.8%

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

      \[\leadsto \color{blue}{{x}^{2} - 4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow274.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.4% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 98.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]

    if 5.00000000000000023e247 < (*.f64 z z)

    1. Initial program 74.8%

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

      \[\leadsto \color{blue}{{x}^{2} - 4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow274.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

    if 4.9999999999999996e-41 < (*.f64 z z) < 4.99999999999999991e295

    1. Initial program 98.3%

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

      \[\leadsto x \cdot x - \color{blue}{4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow285.3%

        \[\leadsto x \cdot x - 4 \cdot \left(y \cdot \color{blue}{\left(z \cdot z\right)}\right) \]
      2. associate-*r*85.3%

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right)} \cdot \left(z \cdot z\right) \]
      4. associate-*r*85.3%

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

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

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

    if 4.99999999999999991e295 < (*.f64 z z)

    1. Initial program 70.1%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. metadata-eval83.7%

        \[\leadsto \color{blue}{\left(-4\right)} \cdot \left(y \cdot {z}^{2}\right) \]
      2. distribute-lft-neg-in83.7%

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
      3. *-commutative83.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 58.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.1 \cdot 10^{+20} \lor \neg \left(x \cdot x \leq 1.45 \cdot 10^{+54}\right) \land x \cdot x \leq 1.75 \cdot 10^{+118}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* x x) 4.1e+20)
         (and (not (<= (* x x) 1.45e+54)) (<= (* x x) 1.75e+118)))
   (* t (* y 4.0))
   (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) <= 4.1e+20) || (!((x * x) <= 1.45e+54) && ((x * x) <= 1.75e+118))) {
		tmp = t * (y * 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) <= 4.1d+20) .or. (.not. ((x * x) <= 1.45d+54)) .and. ((x * x) <= 1.75d+118)) then
        tmp = t * (y * 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) <= 4.1e+20) || (!((x * x) <= 1.45e+54) && ((x * x) <= 1.75e+118))) {
		tmp = t * (y * 4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) <= 4.1e+20) or (not ((x * x) <= 1.45e+54) and ((x * x) <= 1.75e+118)):
		tmp = t * (y * 4.0)
	else:
		tmp = x * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x * x) <= 4.1e+20) || (!(Float64(x * x) <= 1.45e+54) && (Float64(x * x) <= 1.75e+118)))
		tmp = Float64(t * Float64(y * 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) <= 4.1e+20) || (~(((x * x) <= 1.45e+54)) && ((x * x) <= 1.75e+118)))
		tmp = t * (y * 4.0);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 4.1e+20], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 1.45e+54]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 1.75e+118]]], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.1 \cdot 10^{+20} \lor \neg \left(x \cdot x \leq 1.45 \cdot 10^{+54}\right) \land x \cdot x \leq 1.75 \cdot 10^{+118}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.1e20 or 1.4499999999999999e54 < (*.f64 x x) < 1.75000000000000008e118

    1. Initial program 93.6%

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

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

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

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

    if 4.1e20 < (*.f64 x x) < 1.4499999999999999e54 or 1.75000000000000008e118 < (*.f64 x x)

    1. Initial program 90.7%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    3. Step-by-step derivation
      1. unpow273.5%

        \[\leadsto \color{blue}{x \cdot x} \]
    4. Simplified73.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.1 \cdot 10^{+20} \lor \neg \left(x \cdot x \leq 1.45 \cdot 10^{+54}\right) \land x \cdot x \leq 1.75 \cdot 10^{+118}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 5: 95.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+295}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\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) < 4.99999999999999991e295

    1. Initial program 98.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]

    if 4.99999999999999991e295 < (*.f64 z z)

    1. Initial program 70.1%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. metadata-eval83.7%

        \[\leadsto \color{blue}{\left(-4\right)} \cdot \left(y \cdot {z}^{2}\right) \]
      2. distribute-lft-neg-in83.7%

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
      3. *-commutative83.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 50.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;z \leq 1.22 \cdot 10^{-224}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-71}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+20}:\\ \;\;\;\;t_1\\ \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 (* t (* y 4.0))))
   (if (<= z 1.22e-224)
     (* x x)
     (if (<= z 1.35e-185)
       t_1
       (if (<= z 6.5e-71)
         (* x x)
         (if (<= z 2.15e+20) t_1 (* -4.0 (* (* z z) y))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (z <= 1.22e-224) {
		tmp = x * x;
	} else if (z <= 1.35e-185) {
		tmp = t_1;
	} else if (z <= 6.5e-71) {
		tmp = x * x;
	} else if (z <= 2.15e+20) {
		tmp = t_1;
	} 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 = t * (y * 4.0d0)
    if (z <= 1.22d-224) then
        tmp = x * x
    else if (z <= 1.35d-185) then
        tmp = t_1
    else if (z <= 6.5d-71) then
        tmp = x * x
    else if (z <= 2.15d+20) then
        tmp = t_1
    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 = t * (y * 4.0);
	double tmp;
	if (z <= 1.22e-224) {
		tmp = x * x;
	} else if (z <= 1.35e-185) {
		tmp = t_1;
	} else if (z <= 6.5e-71) {
		tmp = x * x;
	} else if (z <= 2.15e+20) {
		tmp = t_1;
	} else {
		tmp = -4.0 * ((z * z) * y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (y * 4.0)
	tmp = 0
	if z <= 1.22e-224:
		tmp = x * x
	elif z <= 1.35e-185:
		tmp = t_1
	elif z <= 6.5e-71:
		tmp = x * x
	elif z <= 2.15e+20:
		tmp = t_1
	else:
		tmp = -4.0 * ((z * z) * y)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * 4.0))
	tmp = 0.0
	if (z <= 1.22e-224)
		tmp = Float64(x * x);
	elseif (z <= 1.35e-185)
		tmp = t_1;
	elseif (z <= 6.5e-71)
		tmp = Float64(x * x);
	elseif (z <= 2.15e+20)
		tmp = t_1;
	else
		tmp = Float64(-4.0 * Float64(Float64(z * z) * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y * 4.0);
	tmp = 0.0;
	if (z <= 1.22e-224)
		tmp = x * x;
	elseif (z <= 1.35e-185)
		tmp = t_1;
	elseif (z <= 6.5e-71)
		tmp = x * x;
	elseif (z <= 2.15e+20)
		tmp = t_1;
	else
		tmp = -4.0 * ((z * z) * y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.22e-224], N[(x * x), $MachinePrecision], If[LessEqual[z, 1.35e-185], t$95$1, If[LessEqual[z, 6.5e-71], N[(x * x), $MachinePrecision], If[LessEqual[z, 2.15e+20], t$95$1, N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 1.35 \cdot 10^{-185}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 6.5 \cdot 10^{-71}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+20}:\\
\;\;\;\;t_1\\

\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 < 1.22000000000000003e-224 or 1.34999999999999994e-185 < z < 6.50000000000000005e-71

    1. Initial program 93.3%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    3. Step-by-step derivation
      1. unpow244.3%

        \[\leadsto \color{blue}{x \cdot x} \]
    4. Simplified44.3%

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

    if 1.22000000000000003e-224 < z < 1.34999999999999994e-185 or 6.50000000000000005e-71 < z < 2.15e20

    1. Initial program 100.0%

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

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

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

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

    if 2.15e20 < z

    1. Initial program 83.2%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow264.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.22 \cdot 10^{-224}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-185}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-71}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+20}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \]

Alternative 7: 51.6% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 3.7 \cdot 10^{-184}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-70}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+20}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 7.20000000000000018e-225 or 3.6999999999999999e-184 < z < 1.5999999999999999e-70

    1. Initial program 93.3%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    3. Step-by-step derivation
      1. unpow244.3%

        \[\leadsto \color{blue}{x \cdot x} \]
    4. Simplified44.3%

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

    if 7.20000000000000018e-225 < z < 3.6999999999999999e-184 or 1.5999999999999999e-70 < z < 2.8e20

    1. Initial program 100.0%

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

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

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

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

    if 2.8e20 < z

    1. Initial program 83.2%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. metadata-eval64.3%

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

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
      3. *-commutative64.3%

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

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

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

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

        \[\leadsto -\color{blue}{z \cdot \left(z \cdot \left(y \cdot 4\right)\right)} \]
      8. distribute-rgt-neg-in76.7%

        \[\leadsto \color{blue}{z \cdot \left(-z \cdot \left(y \cdot 4\right)\right)} \]
      9. distribute-rgt-neg-in76.7%

        \[\leadsto z \cdot \color{blue}{\left(z \cdot \left(-y \cdot 4\right)\right)} \]
      10. distribute-rgt-neg-in76.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 7.2 \cdot 10^{-225}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-184}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-70}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+20}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \]

Alternative 8: 85.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.8%

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

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

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

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

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

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

    if 1.0000000000000001e199 < (*.f64 z z)

    1. Initial program 78.2%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. metadata-eval80.9%

        \[\leadsto \color{blue}{\left(-4\right)} \cdot \left(y \cdot {z}^{2}\right) \]
      2. distribute-lft-neg-in80.9%

        \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
      3. *-commutative80.9%

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

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

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

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

        \[\leadsto -\color{blue}{z \cdot \left(z \cdot \left(y \cdot 4\right)\right)} \]
      8. distribute-rgt-neg-in90.3%

        \[\leadsto \color{blue}{z \cdot \left(-z \cdot \left(y \cdot 4\right)\right)} \]
      9. distribute-rgt-neg-in90.3%

        \[\leadsto z \cdot \color{blue}{\left(z \cdot \left(-y \cdot 4\right)\right)} \]
      10. distribute-rgt-neg-in90.3%

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

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

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

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

Alternative 9: 41.8% accurate, 4.3× 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 92.3%

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

    \[\leadsto \color{blue}{{x}^{2}} \]
  3. Step-by-step derivation
    1. unpow239.3%

      \[\leadsto \color{blue}{x \cdot x} \]
  4. Simplified39.3%

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

    \[\leadsto x \cdot x \]

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

  :herbie-target
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

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