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

Percentage Accurate: 91.2% → 95.6%
Time: 4.5s
Alternatives: 8
Speedup: 0.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 91.2% accurate, 1.0× speedup?

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

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

Alternative 1: 95.6% accurate, 0.1× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{+145}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= z 9e+145)
   (fma x x (* (- (* z z) t) (* y -4.0)))
   (* z (* z (* y -4.0)))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 9e+145) {
		tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (z <= 9e+145)
		tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)));
	else
		tmp = Float64(z * Float64(z * Float64(y * -4.0)));
	end
	return tmp
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[z, 9e+145], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \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 2 regimes
  2. if z < 8.9999999999999996e145

    1. Initial program 93.6%

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

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

        \[\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-in96.0%

        \[\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-in96.0%

        \[\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-eval96.0%

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

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

    if 8.9999999999999996e145 < z

    1. Initial program 68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 57.3% accurate, 0.7× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;z \leq 8.5 \cdot 10^{-224}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-168}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.16 \cdot 10^{+36}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+83}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (* y 4.0))))
   (if (<= z 8.5e-224)
     t_1
     (if (<= z 8e-168)
       (* x x)
       (if (<= z 1.45e-78)
         t_1
         (if (<= z 1.16e+36)
           (* x x)
           (if (<= z 5.5e+56)
             t_1
             (if (<= z 4.4e+83) (* x x) (* -4.0 (* (* z z) y))))))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (z <= 8.5e-224) {
		tmp = t_1;
	} else if (z <= 8e-168) {
		tmp = x * x;
	} else if (z <= 1.45e-78) {
		tmp = t_1;
	} else if (z <= 1.16e+36) {
		tmp = x * x;
	} else if (z <= 5.5e+56) {
		tmp = t_1;
	} else if (z <= 4.4e+83) {
		tmp = x * x;
	} else {
		tmp = -4.0 * ((z * z) * y);
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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 <= 8.5d-224) then
        tmp = t_1
    else if (z <= 8d-168) then
        tmp = x * x
    else if (z <= 1.45d-78) then
        tmp = t_1
    else if (z <= 1.16d+36) then
        tmp = x * x
    else if (z <= 5.5d+56) then
        tmp = t_1
    else if (z <= 4.4d+83) then
        tmp = x * x
    else
        tmp = (-4.0d0) * ((z * z) * y)
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (z <= 8.5e-224) {
		tmp = t_1;
	} else if (z <= 8e-168) {
		tmp = x * x;
	} else if (z <= 1.45e-78) {
		tmp = t_1;
	} else if (z <= 1.16e+36) {
		tmp = x * x;
	} else if (z <= 5.5e+56) {
		tmp = t_1;
	} else if (z <= 4.4e+83) {
		tmp = x * x;
	} else {
		tmp = -4.0 * ((z * z) * y);
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	t_1 = t * (y * 4.0)
	tmp = 0
	if z <= 8.5e-224:
		tmp = t_1
	elif z <= 8e-168:
		tmp = x * x
	elif z <= 1.45e-78:
		tmp = t_1
	elif z <= 1.16e+36:
		tmp = x * x
	elif z <= 5.5e+56:
		tmp = t_1
	elif z <= 4.4e+83:
		tmp = x * x
	else:
		tmp = -4.0 * ((z * z) * y)
	return tmp
z = abs(z)
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * 4.0))
	tmp = 0.0
	if (z <= 8.5e-224)
		tmp = t_1;
	elseif (z <= 8e-168)
		tmp = Float64(x * x);
	elseif (z <= 1.45e-78)
		tmp = t_1;
	elseif (z <= 1.16e+36)
		tmp = Float64(x * x);
	elseif (z <= 5.5e+56)
		tmp = t_1;
	elseif (z <= 4.4e+83)
		tmp = Float64(x * x);
	else
		tmp = Float64(-4.0 * Float64(Float64(z * z) * y));
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y * 4.0);
	tmp = 0.0;
	if (z <= 8.5e-224)
		tmp = t_1;
	elseif (z <= 8e-168)
		tmp = x * x;
	elseif (z <= 1.45e-78)
		tmp = t_1;
	elseif (z <= 1.16e+36)
		tmp = x * x;
	elseif (z <= 5.5e+56)
		tmp = t_1;
	elseif (z <= 4.4e+83)
		tmp = x * x;
	else
		tmp = -4.0 * ((z * z) * y);
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 8.5e-224], t$95$1, If[LessEqual[z, 8e-168], N[(x * x), $MachinePrecision], If[LessEqual[z, 1.45e-78], t$95$1, If[LessEqual[z, 1.16e+36], N[(x * x), $MachinePrecision], If[LessEqual[z, 5.5e+56], t$95$1, If[LessEqual[z, 4.4e+83], N[(x * x), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;z \leq 8.5 \cdot 10^{-224}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 8 \cdot 10^{-168}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 1.45 \cdot 10^{-78}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 1.16 \cdot 10^{+36}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 5.5 \cdot 10^{+56}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4.4 \cdot 10^{+83}:\\
\;\;\;\;x \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 8.4999999999999996e-224 or 8.0000000000000004e-168 < z < 1.45e-78 or 1.15999999999999998e36 < z < 5.5000000000000002e56

    1. Initial program 92.0%

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

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

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

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

    if 8.4999999999999996e-224 < z < 8.0000000000000004e-168 or 1.45e-78 < z < 1.15999999999999998e36 or 5.5000000000000002e56 < z < 4.39999999999999997e83

    1. Initial program 99.9%

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

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

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

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

    if 4.39999999999999997e83 < z

    1. Initial program 76.3%

      \[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 \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow269.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 8.5 \cdot 10^{-224}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-168}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-78}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 1.16 \cdot 10^{+36}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{+56}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+83}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \]

Alternative 3: 60.1% accurate, 0.7× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;z \leq 3.35 \cdot 10^{-223}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-168}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+35}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+83}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (* y 4.0))))
   (if (<= z 3.35e-223)
     t_1
     (if (<= z 4.1e-168)
       (* x x)
       (if (<= z 1.02e-78)
         t_1
         (if (<= z 5e+35)
           (* x x)
           (if (<= z 8e+62)
             t_1
             (if (<= z 4.2e+83) (* x x) (* z (* z (* y -4.0)))))))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (z <= 3.35e-223) {
		tmp = t_1;
	} else if (z <= 4.1e-168) {
		tmp = x * x;
	} else if (z <= 1.02e-78) {
		tmp = t_1;
	} else if (z <= 5e+35) {
		tmp = x * x;
	} else if (z <= 8e+62) {
		tmp = t_1;
	} else if (z <= 4.2e+83) {
		tmp = x * x;
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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 <= 3.35d-223) then
        tmp = t_1
    else if (z <= 4.1d-168) then
        tmp = x * x
    else if (z <= 1.02d-78) then
        tmp = t_1
    else if (z <= 5d+35) then
        tmp = x * x
    else if (z <= 8d+62) then
        tmp = t_1
    else if (z <= 4.2d+83) then
        tmp = x * x
    else
        tmp = z * (z * (y * (-4.0d0)))
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (z <= 3.35e-223) {
		tmp = t_1;
	} else if (z <= 4.1e-168) {
		tmp = x * x;
	} else if (z <= 1.02e-78) {
		tmp = t_1;
	} else if (z <= 5e+35) {
		tmp = x * x;
	} else if (z <= 8e+62) {
		tmp = t_1;
	} else if (z <= 4.2e+83) {
		tmp = x * x;
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	t_1 = t * (y * 4.0)
	tmp = 0
	if z <= 3.35e-223:
		tmp = t_1
	elif z <= 4.1e-168:
		tmp = x * x
	elif z <= 1.02e-78:
		tmp = t_1
	elif z <= 5e+35:
		tmp = x * x
	elif z <= 8e+62:
		tmp = t_1
	elif z <= 4.2e+83:
		tmp = x * x
	else:
		tmp = z * (z * (y * -4.0))
	return tmp
z = abs(z)
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * 4.0))
	tmp = 0.0
	if (z <= 3.35e-223)
		tmp = t_1;
	elseif (z <= 4.1e-168)
		tmp = Float64(x * x);
	elseif (z <= 1.02e-78)
		tmp = t_1;
	elseif (z <= 5e+35)
		tmp = Float64(x * x);
	elseif (z <= 8e+62)
		tmp = t_1;
	elseif (z <= 4.2e+83)
		tmp = Float64(x * x);
	else
		tmp = Float64(z * Float64(z * Float64(y * -4.0)));
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y * 4.0);
	tmp = 0.0;
	if (z <= 3.35e-223)
		tmp = t_1;
	elseif (z <= 4.1e-168)
		tmp = x * x;
	elseif (z <= 1.02e-78)
		tmp = t_1;
	elseif (z <= 5e+35)
		tmp = x * x;
	elseif (z <= 8e+62)
		tmp = t_1;
	elseif (z <= 4.2e+83)
		tmp = x * x;
	else
		tmp = z * (z * (y * -4.0));
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3.35e-223], t$95$1, If[LessEqual[z, 4.1e-168], N[(x * x), $MachinePrecision], If[LessEqual[z, 1.02e-78], t$95$1, If[LessEqual[z, 5e+35], N[(x * x), $MachinePrecision], If[LessEqual[z, 8e+62], t$95$1, If[LessEqual[z, 4.2e+83], N[(x * x), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;z \leq 3.35 \cdot 10^{-223}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4.1 \cdot 10^{-168}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 1.02 \cdot 10^{-78}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 5 \cdot 10^{+35}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z \leq 8 \cdot 10^{+62}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq 4.2 \cdot 10^{+83}:\\
\;\;\;\;x \cdot x\\

\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 < 3.3500000000000001e-223 or 4.0999999999999998e-168 < z < 1.02e-78 or 5.00000000000000021e35 < z < 8.00000000000000028e62

    1. Initial program 92.0%

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

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

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

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

    if 3.3500000000000001e-223 < z < 4.0999999999999998e-168 or 1.02e-78 < z < 5.00000000000000021e35 or 8.00000000000000028e62 < z < 4.20000000000000005e83

    1. Initial program 99.9%

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

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

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

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

    if 4.20000000000000005e83 < z

    1. Initial program 76.3%

      \[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 \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Step-by-step derivation
      1. metadata-eval69.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3.35 \cdot 10^{-223}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 4.1 \cdot 10^{-168}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-78}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+35}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 8 \cdot 10^{+62}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+83}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \]

Alternative 4: 94.7% accurate, 0.9× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 3.1 \cdot 10^{+138}:\\ \;\;\;\;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} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= z 3.1e+138)
   (+ (* x x) (* (* y 4.0) (- t (* z z))))
   (* z (* z (* y -4.0)))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 3.1e+138) {
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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 <= 3.1d+138) then
        tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
    else
        tmp = z * (z * (y * (-4.0d0)))
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 3.1e+138) {
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	tmp = 0
	if z <= 3.1e+138:
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)))
	else:
		tmp = z * (z * (y * -4.0))
	return tmp
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (z <= 3.1e+138)
		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
z = abs(z)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= 3.1e+138)
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	else
		tmp = z * (z * (y * -4.0));
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[z, 3.1e+138], 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}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.1 \cdot 10^{+138}:\\
\;\;\;\;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 z < 3.0999999999999998e138

    1. Initial program 93.5%

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

    if 3.0999999999999998e138 < z

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3.1 \cdot 10^{+138}:\\ \;\;\;\;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 5: 80.3% accurate, 1.0× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 3 \cdot 10^{+213}:\\ \;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= (* x x) 3e+213) (* (- (* z z) t) (* y -4.0)) (* x x)))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 3e+213) {
		tmp = ((z * z) - t) * (y * -4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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) <= 3d+213) then
        tmp = ((z * z) - t) * (y * (-4.0d0))
    else
        tmp = x * x
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 3e+213) {
		tmp = ((z * z) - t) * (y * -4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	tmp = 0
	if (x * x) <= 3e+213:
		tmp = ((z * z) - t) * (y * -4.0)
	else:
		tmp = x * x
	return tmp
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x * x) <= 3e+213)
		tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x * x) <= 3e+213)
		tmp = ((z * z) - t) * (y * -4.0);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 3e+213], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 3 \cdot 10^{+213}:\\
\;\;\;\;\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) < 3.0000000000000001e213

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

    if 3.0000000000000001e213 < (*.f64 x x)

    1. Initial program 81.0%

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

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

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

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

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

Alternative 6: 84.9% accurate, 1.0× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+167}:\\ \;\;\;\;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} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 2e+167) (- (* x x) (* t (* y -4.0))) (* z (* z (* y -4.0)))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 2e+167) {
		tmp = (x * x) - (t * (y * -4.0));
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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) <= 2d+167) then
        tmp = (x * x) - (t * (y * (-4.0d0)))
    else
        tmp = z * (z * (y * (-4.0d0)))
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 2e+167) {
		tmp = (x * x) - (t * (y * -4.0));
	} else {
		tmp = z * (z * (y * -4.0));
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	tmp = 0
	if (z * z) <= 2e+167:
		tmp = (x * x) - (t * (y * -4.0))
	else:
		tmp = z * (z * (y * -4.0))
	return tmp
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 2e+167)
		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
z = abs(z)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * z) <= 2e+167)
		tmp = (x * x) - (t * (y * -4.0));
	else
		tmp = z * (z * (y * -4.0));
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+167], 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}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+167}:\\
\;\;\;\;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) < 2.0000000000000001e167

    1. Initial program 98.6%

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

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

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

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

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

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

    if 2.0000000000000001e167 < (*.f64 z z)

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+167}:\\ \;\;\;\;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 7: 59.2% accurate, 1.4× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 6.6 \cdot 10^{+37}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= (* x x) 6.6e+37) (* t (* y 4.0)) (* x x)))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 6.6e+37) {
		tmp = t * (y * 4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
NOTE: z should be positive before calling this function
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) <= 6.6d+37) then
        tmp = t * (y * 4.0d0)
    else
        tmp = x * x
    end if
    code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 6.6e+37) {
		tmp = t * (y * 4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	tmp = 0
	if (x * x) <= 6.6e+37:
		tmp = t * (y * 4.0)
	else:
		tmp = x * x
	return tmp
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x * x) <= 6.6e+37)
		tmp = Float64(t * Float64(y * 4.0));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x * x) <= 6.6e+37)
		tmp = t * (y * 4.0);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 6.6e+37], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 6.6 \cdot 10^{+37}:\\
\;\;\;\;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) < 6.6000000000000002e37

    1. Initial program 93.5%

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

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

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

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

    if 6.6000000000000002e37 < (*.f64 x x)

    1. Initial program 84.8%

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

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

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

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

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

Alternative 8: 41.7% accurate, 4.3× speedup?

\[\begin{array}{l} z = |z|\\ \\ x \cdot x \end{array} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t) :precision binary64 (* x x))
z = abs(z);
double code(double x, double y, double z, double t) {
	return x * x;
}
NOTE: z should be positive before calling this function
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
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	return x * x;
}
z = abs(z)
def code(x, y, z, t):
	return x * x
z = abs(z)
function code(x, y, z, t)
	return Float64(x * x)
end
z = abs(z)
function tmp = code(x, y, z, t)
	tmp = x * x;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
z = |z|\\
\\
x \cdot x
\end{array}
Derivation
  1. Initial program 89.7%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 91.2% accurate, 1.0× speedup?

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

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

Reproduce

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