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

Percentage Accurate: 91.0% → 96.1%
Time: 6.4s
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: 91.0% 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: 96.1% accurate, 0.1× speedup?

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

\mathbf{else}:\\
\;\;\;\;x \cdot x - 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) < 5.00000000000000029e278

    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.00000000000000029e278 < (*.f64 z z)

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

Alternative 2: 80.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+81} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{+218}\right) \land x \cdot x \leq 6 \cdot 10^{+256}:\\ \;\;\;\;\left(z \cdot z - t\right) \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) 2e+81)
         (and (not (<= (* x x) 4e+218)) (<= (* x x) 6e+256)))
   (* (- (* z z) t) (* y -4.0))
   (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) <= 2e+81) || (!((x * x) <= 4e+218) && ((x * x) <= 6e+256))) {
		tmp = ((z * z) - 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) <= 2d+81) .or. (.not. ((x * x) <= 4d+218)) .and. ((x * x) <= 6d+256)) then
        tmp = ((z * z) - 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) <= 2e+81) || (!((x * x) <= 4e+218) && ((x * x) <= 6e+256))) {
		tmp = ((z * z) - t) * (y * -4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) <= 2e+81) or (not ((x * x) <= 4e+218) and ((x * x) <= 6e+256)):
		tmp = ((z * z) - t) * (y * -4.0)
	else:
		tmp = x * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x * x) <= 2e+81) || (!(Float64(x * x) <= 4e+218) && (Float64(x * x) <= 6e+256)))
		tmp = Float64(Float64(Float64(z * z) - 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) <= 2e+81) || (~(((x * x) <= 4e+218)) && ((x * x) <= 6e+256)))
		tmp = ((z * z) - 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], 2e+81], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 4e+218]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 6e+256]]], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+81} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{+218}\right) \land x \cdot x \leq 6 \cdot 10^{+256}:\\
\;\;\;\;\left(z \cdot z - t\right) \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) < 1.99999999999999984e81 or 4.00000000000000033e218 < (*.f64 x x) < 6.0000000000000002e256

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

    if 1.99999999999999984e81 < (*.f64 x x) < 4.00000000000000033e218 or 6.0000000000000002e256 < (*.f64 x x)

    1. Initial program 87.6%

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

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

        \[\leadsto \color{blue}{x \cdot x} \]
    4. Simplified82.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+81} \lor \neg \left(x \cdot x \leq 4 \cdot 10^{+218}\right) \land x \cdot x \leq 6 \cdot 10^{+256}:\\ \;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 3: 84.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-46}:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\ \mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+278}:\\ \;\;\;\;\left(z \cdot z - t\right) \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) 5e-46)
   (- (* x x) (* t (* y -4.0)))
   (if (<= (* z z) 5e+278)
     (* (- (* z z) t) (* y -4.0))
     (* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 5e-46) {
		tmp = (x * x) - (t * (y * -4.0));
	} else if ((z * z) <= 5e+278) {
		tmp = ((z * z) - 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) <= 5d-46) then
        tmp = (x * x) - (t * (y * (-4.0d0)))
    else if ((z * z) <= 5d+278) then
        tmp = ((z * z) - 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) <= 5e-46) {
		tmp = (x * x) - (t * (y * -4.0));
	} else if ((z * z) <= 5e+278) {
		tmp = ((z * z) - t) * (y * -4.0);
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * z) <= 5e-46:
		tmp = (x * x) - (t * (y * -4.0))
	elif (z * z) <= 5e+278:
		tmp = ((z * z) - 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) <= 5e-46)
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0)));
	elseif (Float64(z * z) <= 5e+278)
		tmp = Float64(Float64(Float64(z * z) - 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) <= 5e-46)
		tmp = (x * x) - (t * (y * -4.0));
	elseif ((z * z) <= 5e+278)
		tmp = ((z * z) - 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], 5e-46], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+278], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+278}:\\
\;\;\;\;\left(z \cdot z - t\right) \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 3 regimes
  2. if (*.f64 z z) < 4.99999999999999992e-46

    1. Initial program 100.0%

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

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

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

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

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

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

    if 4.99999999999999992e-46 < (*.f64 z z) < 5.00000000000000029e278

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

    if 5.00000000000000029e278 < (*.f64 z z)

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.6% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;x \cdot x - 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) < 5.00000000000000029e278

    1. Initial program 98.9%

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

    if 5.00000000000000029e278 < (*.f64 z z)

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

Alternative 5: 88.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -70000 \lor \neg \left(z \leq 8.4 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7e4 or 8.39999999999999951e-58 < z

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

    if -7e4 < z < 8.39999999999999951e-58

    1. Initial program 100.0%

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

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

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

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

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

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

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

Alternative 6: 59.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 92.4%

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

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

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

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

    if 5.79999999999999984e-89 < (*.f64 x x) < 5.80000000000000023e68

    1. Initial program 96.0%

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

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

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

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

    if 5.80000000000000023e68 < (*.f64 x x)

    1. Initial program 88.7%

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

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

        \[\leadsto \color{blue}{x \cdot x} \]
    4. Simplified77.8%

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

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

Alternative 7: 60.6% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 92.4%

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

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

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

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

    if 8.2000000000000002e-88 < (*.f64 x x) < 6.5000000000000001e90

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000001e90 < (*.f64 x x)

    1. Initial program 89.5%

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

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

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

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

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

Alternative 8: 58.6% accurate, 1.4× speedup?

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

    1. Initial program 92.5%

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

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

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

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

    if 4.29999999999999999e-85 < (*.f64 x x)

    1. Initial program 90.0%

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

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

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

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

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

Alternative 9: 40.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 91.2%

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

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

      \[\leadsto \color{blue}{x \cdot x} \]
  4. Simplified38.0%

    \[\leadsto \color{blue}{x \cdot x} \]
  5. Final simplification38.0%

    \[\leadsto x \cdot x \]

Developer target: 91.1% 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 2023173 
(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))))