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

Percentage Accurate: 90.9% → 95.5%
Time: 17.1s
Alternatives: 11
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 11 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: 95.5% accurate, 0.1× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 9.2 \cdot 10^{+167}:\\ \;\;\;\;\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 9.2e+167)
   (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 <= 9.2e+167) {
		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 <= 9.2e+167)
		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, 9.2e+167], 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.2 \cdot 10^{+167}:\\
\;\;\;\;\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 < 9.19999999999999952e167

    1. Initial program 91.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)} \]
      2. *-commutative95.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-in95.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-in95.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-eval95.0%

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

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

    if 9.19999999999999952e167 < z

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ t_2 := t \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;x \cdot x \leq 1.28 \cdot 10^{-267}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 1.72 \cdot 10^{-239}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 1.55 \cdot 10^{-173}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 1.65 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \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
 (let* ((t_1 (* -4.0 (* (* z z) y))) (t_2 (* t (* y 4.0))))
   (if (<= (* x x) 1.28e-267)
     t_2
     (if (<= (* x x) 1.72e-239)
       t_1
       (if (<= (* x x) 1.55e-173)
         t_2
         (if (<= (* x x) 1.65e+19) t_1 (* x x)))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double t_1 = -4.0 * ((z * z) * y);
	double t_2 = t * (y * 4.0);
	double tmp;
	if ((x * x) <= 1.28e-267) {
		tmp = t_2;
	} else if ((x * x) <= 1.72e-239) {
		tmp = t_1;
	} else if ((x * x) <= 1.55e-173) {
		tmp = t_2;
	} else if ((x * x) <= 1.65e+19) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (-4.0d0) * ((z * z) * y)
    t_2 = t * (y * 4.0d0)
    if ((x * x) <= 1.28d-267) then
        tmp = t_2
    else if ((x * x) <= 1.72d-239) then
        tmp = t_1
    else if ((x * x) <= 1.55d-173) then
        tmp = t_2
    else if ((x * x) <= 1.65d+19) then
        tmp = t_1
    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 t_1 = -4.0 * ((z * z) * y);
	double t_2 = t * (y * 4.0);
	double tmp;
	if ((x * x) <= 1.28e-267) {
		tmp = t_2;
	} else if ((x * x) <= 1.72e-239) {
		tmp = t_1;
	} else if ((x * x) <= 1.55e-173) {
		tmp = t_2;
	} else if ((x * x) <= 1.65e+19) {
		tmp = t_1;
	} else {
		tmp = x * x;
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	t_1 = -4.0 * ((z * z) * y)
	t_2 = t * (y * 4.0)
	tmp = 0
	if (x * x) <= 1.28e-267:
		tmp = t_2
	elif (x * x) <= 1.72e-239:
		tmp = t_1
	elif (x * x) <= 1.55e-173:
		tmp = t_2
	elif (x * x) <= 1.65e+19:
		tmp = t_1
	else:
		tmp = x * x
	return tmp
z = abs(z)
function code(x, y, z, t)
	t_1 = Float64(-4.0 * Float64(Float64(z * z) * y))
	t_2 = Float64(t * Float64(y * 4.0))
	tmp = 0.0
	if (Float64(x * x) <= 1.28e-267)
		tmp = t_2;
	elseif (Float64(x * x) <= 1.72e-239)
		tmp = t_1;
	elseif (Float64(x * x) <= 1.55e-173)
		tmp = t_2;
	elseif (Float64(x * x) <= 1.65e+19)
		tmp = t_1;
	else
		tmp = Float64(x * x);
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	t_1 = -4.0 * ((z * z) * y);
	t_2 = t * (y * 4.0);
	tmp = 0.0;
	if ((x * x) <= 1.28e-267)
		tmp = t_2;
	elseif ((x * x) <= 1.72e-239)
		tmp = t_1;
	elseif ((x * x) <= 1.55e-173)
		tmp = t_2;
	elseif ((x * x) <= 1.65e+19)
		tmp = t_1;
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1.28e-267], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 1.72e-239], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.55e-173], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 1.65e+19], t$95$1, N[(x * x), $MachinePrecision]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
t_2 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 1.28 \cdot 10^{-267}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 1.72 \cdot 10^{-239}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \cdot x \leq 1.55 \cdot 10^{-173}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 1.65 \cdot 10^{+19}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 1.2799999999999999e-267 or 1.72000000000000005e-239 < (*.f64 x x) < 1.55000000000000003e-173

    1. Initial program 95.9%

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

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

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

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

    if 1.2799999999999999e-267 < (*.f64 x x) < 1.72000000000000005e-239 or 1.55000000000000003e-173 < (*.f64 x x) < 1.65e19

    1. Initial program 93.9%

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

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

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

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

    if 1.65e19 < (*.f64 x x)

    1. Initial program 85.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.28 \cdot 10^{-267}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \cdot x \leq 1.72 \cdot 10^{-239}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \cdot x \leq 1.55 \cdot 10^{-173}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \cdot x \leq 1.65 \cdot 10^{+19}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 3: 49.8% accurate, 0.8× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot 4\right)\\ t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{if}\;x \leq 5 \cdot 10^{-201}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-135}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.75 \cdot 10^{-120}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1000000000000:\\ \;\;\;\;t_2\\ \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
 (let* ((t_1 (* t (* y 4.0))) (t_2 (* z (* z (* y -4.0)))))
   (if (<= x 5e-201)
     t_2
     (if (<= x 2.8e-135)
       t_1
       (if (<= x 2.75e-120)
         (* -4.0 (* (* z z) y))
         (if (<= x 2.8e-87) t_1 (if (<= x 1000000000000.0) t_2 (* x x))))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double t_2 = z * (z * (y * -4.0));
	double tmp;
	if (x <= 5e-201) {
		tmp = t_2;
	} else if (x <= 2.8e-135) {
		tmp = t_1;
	} else if (x <= 2.75e-120) {
		tmp = -4.0 * ((z * z) * y);
	} else if (x <= 2.8e-87) {
		tmp = t_1;
	} else if (x <= 1000000000000.0) {
		tmp = t_2;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = t * (y * 4.0d0)
    t_2 = z * (z * (y * (-4.0d0)))
    if (x <= 5d-201) then
        tmp = t_2
    else if (x <= 2.8d-135) then
        tmp = t_1
    else if (x <= 2.75d-120) then
        tmp = (-4.0d0) * ((z * z) * y)
    else if (x <= 2.8d-87) then
        tmp = t_1
    else if (x <= 1000000000000.0d0) then
        tmp = t_2
    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 t_1 = t * (y * 4.0);
	double t_2 = z * (z * (y * -4.0));
	double tmp;
	if (x <= 5e-201) {
		tmp = t_2;
	} else if (x <= 2.8e-135) {
		tmp = t_1;
	} else if (x <= 2.75e-120) {
		tmp = -4.0 * ((z * z) * y);
	} else if (x <= 2.8e-87) {
		tmp = t_1;
	} else if (x <= 1000000000000.0) {
		tmp = t_2;
	} else {
		tmp = x * x;
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	t_1 = t * (y * 4.0)
	t_2 = z * (z * (y * -4.0))
	tmp = 0
	if x <= 5e-201:
		tmp = t_2
	elif x <= 2.8e-135:
		tmp = t_1
	elif x <= 2.75e-120:
		tmp = -4.0 * ((z * z) * y)
	elif x <= 2.8e-87:
		tmp = t_1
	elif x <= 1000000000000.0:
		tmp = t_2
	else:
		tmp = x * x
	return tmp
z = abs(z)
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * 4.0))
	t_2 = Float64(z * Float64(z * Float64(y * -4.0)))
	tmp = 0.0
	if (x <= 5e-201)
		tmp = t_2;
	elseif (x <= 2.8e-135)
		tmp = t_1;
	elseif (x <= 2.75e-120)
		tmp = Float64(-4.0 * Float64(Float64(z * z) * y));
	elseif (x <= 2.8e-87)
		tmp = t_1;
	elseif (x <= 1000000000000.0)
		tmp = t_2;
	else
		tmp = Float64(x * x);
	end
	return tmp
end
z = abs(z)
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y * 4.0);
	t_2 = z * (z * (y * -4.0));
	tmp = 0.0;
	if (x <= 5e-201)
		tmp = t_2;
	elseif (x <= 2.8e-135)
		tmp = t_1;
	elseif (x <= 2.75e-120)
		tmp = -4.0 * ((z * z) * y);
	elseif (x <= 2.8e-87)
		tmp = t_1;
	elseif (x <= 1000000000000.0)
		tmp = t_2;
	else
		tmp = x * x;
	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]}, Block[{t$95$2 = N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5e-201], t$95$2, If[LessEqual[x, 2.8e-135], t$95$1, If[LessEqual[x, 2.75e-120], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e-87], t$95$1, If[LessEqual[x, 1000000000000.0], t$95$2, N[(x * x), $MachinePrecision]]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
t_2 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{if}\;x \leq 5 \cdot 10^{-201}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-135}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 1000000000000:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < 4.9999999999999999e-201 or 2.8000000000000001e-87 < x < 1e12

    1. Initial program 91.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e-201 < x < 2.80000000000000023e-135 or 2.7500000000000001e-120 < x < 2.8000000000000001e-87

    1. Initial program 99.9%

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

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

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

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

    if 2.80000000000000023e-135 < x < 2.7500000000000001e-120

    1. Initial program 99.7%

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

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

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

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

    if 1e12 < x

    1. Initial program 81.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5 \cdot 10^{-201}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-135}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 2.75 \cdot 10^{-120}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-87}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 1000000000000:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 4: 49.8% accurate, 0.8× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} t_1 := t \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;x \leq 1.3 \cdot 10^{-200}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{elif}\;x \leq 1.88 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-120}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 980000000000:\\ \;\;\;\;z \cdot \left(-4 \cdot \left(z \cdot y\right)\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
 (let* ((t_1 (* t (* y 4.0))))
   (if (<= x 1.3e-200)
     (* z (* z (* y -4.0)))
     (if (<= x 1.88e-134)
       t_1
       (if (<= x 2.7e-120)
         (* -4.0 (* (* z z) y))
         (if (<= x 2.6e-87)
           t_1
           (if (<= x 980000000000.0) (* z (* -4.0 (* z y))) (* x x))))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double t_1 = t * (y * 4.0);
	double tmp;
	if (x <= 1.3e-200) {
		tmp = z * (z * (y * -4.0));
	} else if (x <= 1.88e-134) {
		tmp = t_1;
	} else if (x <= 2.7e-120) {
		tmp = -4.0 * ((z * z) * y);
	} else if (x <= 2.6e-87) {
		tmp = t_1;
	} else if (x <= 980000000000.0) {
		tmp = z * (-4.0 * (z * y));
	} 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) :: t_1
    real(8) :: tmp
    t_1 = t * (y * 4.0d0)
    if (x <= 1.3d-200) then
        tmp = z * (z * (y * (-4.0d0)))
    else if (x <= 1.88d-134) then
        tmp = t_1
    else if (x <= 2.7d-120) then
        tmp = (-4.0d0) * ((z * z) * y)
    else if (x <= 2.6d-87) then
        tmp = t_1
    else if (x <= 980000000000.0d0) then
        tmp = z * ((-4.0d0) * (z * y))
    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 t_1 = t * (y * 4.0);
	double tmp;
	if (x <= 1.3e-200) {
		tmp = z * (z * (y * -4.0));
	} else if (x <= 1.88e-134) {
		tmp = t_1;
	} else if (x <= 2.7e-120) {
		tmp = -4.0 * ((z * z) * y);
	} else if (x <= 2.6e-87) {
		tmp = t_1;
	} else if (x <= 980000000000.0) {
		tmp = z * (-4.0 * (z * y));
	} else {
		tmp = x * x;
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	t_1 = t * (y * 4.0)
	tmp = 0
	if x <= 1.3e-200:
		tmp = z * (z * (y * -4.0))
	elif x <= 1.88e-134:
		tmp = t_1
	elif x <= 2.7e-120:
		tmp = -4.0 * ((z * z) * y)
	elif x <= 2.6e-87:
		tmp = t_1
	elif x <= 980000000000.0:
		tmp = z * (-4.0 * (z * y))
	else:
		tmp = x * x
	return tmp
z = abs(z)
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y * 4.0))
	tmp = 0.0
	if (x <= 1.3e-200)
		tmp = Float64(z * Float64(z * Float64(y * -4.0)));
	elseif (x <= 1.88e-134)
		tmp = t_1;
	elseif (x <= 2.7e-120)
		tmp = Float64(-4.0 * Float64(Float64(z * z) * y));
	elseif (x <= 2.6e-87)
		tmp = t_1;
	elseif (x <= 980000000000.0)
		tmp = Float64(z * Float64(-4.0 * Float64(z * y)));
	else
		tmp = Float64(x * x);
	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 (x <= 1.3e-200)
		tmp = z * (z * (y * -4.0));
	elseif (x <= 1.88e-134)
		tmp = t_1;
	elseif (x <= 2.7e-120)
		tmp = -4.0 * ((z * z) * y);
	elseif (x <= 2.6e-87)
		tmp = t_1;
	elseif (x <= 980000000000.0)
		tmp = z * (-4.0 * (z * y));
	else
		tmp = x * x;
	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[x, 1.3e-200], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.88e-134], t$95$1, If[LessEqual[x, 2.7e-120], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e-87], t$95$1, If[LessEqual[x, 980000000000.0], N[(z * N[(-4.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \leq 1.3 \cdot 10^{-200}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\

\mathbf{elif}\;x \leq 1.88 \cdot 10^{-134}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 980000000000:\\
\;\;\;\;z \cdot \left(-4 \cdot \left(z \cdot y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < 1.29999999999999995e-200

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999995e-200 < x < 1.8799999999999999e-134 or 2.6999999999999999e-120 < x < 2.60000000000000002e-87

    1. Initial program 99.9%

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

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

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

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

    if 1.8799999999999999e-134 < x < 2.6999999999999999e-120

    1. Initial program 99.7%

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

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

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

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

    if 2.60000000000000002e-87 < x < 9.8e11

    1. Initial program 90.3%

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

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

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left(z \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt22.9%

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

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

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

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

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

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

        \[\leadsto -4 \cdot \sqrt{\left({z}^{2} \cdot \color{blue}{{z}^{2}}\right) \cdot \left(y \cdot y\right)} \]
      8. pow-prod-up17.7%

        \[\leadsto -4 \cdot \sqrt{\color{blue}{{z}^{\left(2 + 2\right)}} \cdot \left(y \cdot y\right)} \]
      9. metadata-eval17.7%

        \[\leadsto -4 \cdot \sqrt{{z}^{\color{blue}{4}} \cdot \left(y \cdot y\right)} \]
    6. Applied egg-rr17.7%

      \[\leadsto -4 \cdot \color{blue}{\sqrt{{z}^{4} \cdot \left(y \cdot y\right)}} \]
    7. Taylor expanded in z around 0 39.3%

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

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

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

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

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

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

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

    if 9.8e11 < x

    1. Initial program 81.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.3 \cdot 10^{-200}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{elif}\;x \leq 1.88 \cdot 10^{-134}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-120}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-87}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 980000000000:\\ \;\;\;\;z \cdot \left(-4 \cdot \left(z \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 5: 83.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 94.7%

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

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

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

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

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

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

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

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

    if 7.19999999999999986e-32 < (*.f64 x x) < 3.8000000000000001e239

    1. Initial program 93.0%

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

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

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

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

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

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

    if 3.8000000000000001e239 < (*.f64 x x)

    1. Initial program 82.1%

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

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

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

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

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

Alternative 6: 89.4% accurate, 0.9× speedup?

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

\mathbf{elif}\;z \leq 2.45 \cdot 10^{+157}:\\
\;\;\;\;x \cdot x + y \cdot \left(\left(z \cdot z\right) \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 z < 3.8e21

    1. Initial program 91.1%

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

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

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

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

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

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

    if 3.8e21 < z < 2.4500000000000001e157

    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 inf 100.0%

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

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

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(\left(4 \cdot y\right) \cdot z\right) \cdot z} \]
    5. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto \color{blue}{\left(-\left(\left(4 \cdot y\right) \cdot z\right) \cdot z\right) + x \cdot x} \]
      3. distribute-lft-neg-in100.0%

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

        \[\leadsto \left(-\color{blue}{4 \cdot \left(y \cdot z\right)}\right) \cdot z + x \cdot x \]
      5. distribute-lft-neg-in100.0%

        \[\leadsto \color{blue}{\left(\left(-4\right) \cdot \left(y \cdot z\right)\right)} \cdot z + x \cdot x \]
      6. metadata-eval100.0%

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

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

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

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

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

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

    if 2.4500000000000001e157 < z

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 90.0% accurate, 0.9× speedup?

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

    1. Initial program 97.2%

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

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

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

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

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

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

    if 4.99999999999999957e28 < (*.f64 z z)

    1. Initial program 81.9%

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

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

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

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

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

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

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

      \[\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 simplification89.1%

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

Alternative 8: 95.6% accurate, 0.9× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;z \leq 9 \cdot 10^{+119}:\\ \;\;\;\;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} \]
NOTE: z should be positive before calling this function
(FPCore (x y z t)
 :precision binary64
 (if (<= z 9e+119)
   (+ (* x x) (* (* y 4.0) (- t (* z z))))
   (- (* x x) (* z (* z (* y 4.0))))))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 9e+119) {
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = (x * x) - (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 <= 9d+119) 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
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 9e+119) {
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = (x * x) - (z * (z * (y * 4.0)));
	}
	return tmp;
}
z = abs(z)
def code(x, y, z, t):
	tmp = 0
	if z <= 9e+119:
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)))
	else:
		tmp = (x * x) - (z * (z * (y * 4.0)))
	return tmp
z = abs(z)
function code(x, y, z, t)
	tmp = 0.0
	if (z <= 9e+119)
		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
z = abs(z)
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= 9e+119)
		tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
	else
		tmp = (x * x) - (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, 9e+119], 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}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9 \cdot 10^{+119}:\\
\;\;\;\;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 z < 9.00000000000000039e119

    1. Initial program 91.6%

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

    if 9.00000000000000039e119 < z

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.4 \cdot 10^{+149}:\\ \;\;\;\;\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) 1.4e+149) (* (- (* 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) <= 1.4e+149) {
		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) <= 1.4d+149) 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) <= 1.4e+149) {
		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) <= 1.4e+149:
		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) <= 1.4e+149)
		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) <= 1.4e+149)
		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], 1.4e+149], 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 1.4 \cdot 10^{+149}:\\
\;\;\;\;\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.4e149

    1. Initial program 94.5%

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

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

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

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

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

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

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

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

    if 1.4e149 < (*.f64 x x)

    1. Initial program 84.3%

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

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

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

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

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

Alternative 10: 58.7% accurate, 1.4× speedup?

\[\begin{array}{l} z = |z|\\ \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 7.2 \cdot 10^{-23}:\\ \;\;\;\;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) 7.2e-23) (* t (* y 4.0)) (* x x)))
z = abs(z);
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 7.2e-23) {
		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) <= 7.2d-23) 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) <= 7.2e-23) {
		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) <= 7.2e-23:
		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) <= 7.2e-23)
		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) <= 7.2e-23)
		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], 7.2e-23], 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 7.2 \cdot 10^{-23}:\\
\;\;\;\;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) < 7.1999999999999996e-23

    1. Initial program 94.9%

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

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

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

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

    if 7.1999999999999996e-23 < (*.f64 x x)

    1. Initial program 86.2%

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

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

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

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

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

Alternative 11: 40.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 90.5%

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

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

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

    \[\leadsto \color{blue}{x \cdot x} \]
  5. Final simplification43.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 2023274 
(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))))