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

Percentage Accurate: 91.3% → 96.4%
Time: 9.5s
Alternatives: 10
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 91.3% accurate, 1.0× speedup?

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

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

Alternative 1: 96.4% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 96.2%

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

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

        \[\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-in97.8%

        \[\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-in97.8%

        \[\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-eval97.8%

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

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

    if 5e307 < (*.f64 z z)

    1. Initial program 68.2%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u30.4%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*30.4%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr30.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def30.4%

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

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

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

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

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

Alternative 2: 85.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+132}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+206}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 3.99999999999999978e34 or 1.99999999999999998e132 < (*.f64 z z) < 5.0000000000000002e206

    1. Initial program 97.3%

      \[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(t \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*l*90.3%

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

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

    if 3.99999999999999978e34 < (*.f64 z z) < 1.99999999999999998e132

    1. Initial program 95.0%

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

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

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

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

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

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

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

    if 5.0000000000000002e206 < (*.f64 z z)

    1. Initial program 71.8%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u36.3%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*33.5%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr33.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def36.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)\right)} \]
      2. expm1-log1p77.7%

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

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

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

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

Alternative 3: 94.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 96.6%

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

    if 9.99999999999999952e246 < (*.f64 z z)

    1. Initial program 69.8%

      \[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. *-commutative78.9%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u34.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)\right)} \]
      2. expm1-udef32.9%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*32.9%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr32.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def34.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)\right)} \]
      2. expm1-log1p78.9%

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

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

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

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

Alternative 4: 44.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 2 \cdot 10^{-105}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 11000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+66}\right) \land z \leq 1.75 \cdot 10^{+103}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z 2e-105)
   (* y (* t 4.0))
   (if (or (<= z 11000000000.0) (and (not (<= z 5.8e+66)) (<= z 1.75e+103)))
     (* x x)
     (* y (* (* z z) -4.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 2e-105) {
		tmp = y * (t * 4.0);
	} else if ((z <= 11000000000.0) || (!(z <= 5.8e+66) && (z <= 1.75e+103))) {
		tmp = x * x;
	} else {
		tmp = y * ((z * z) * -4.0);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= 2d-105) then
        tmp = y * (t * 4.0d0)
    else if ((z <= 11000000000.0d0) .or. (.not. (z <= 5.8d+66)) .and. (z <= 1.75d+103)) then
        tmp = x * x
    else
        tmp = y * ((z * z) * (-4.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= 2e-105) {
		tmp = y * (t * 4.0);
	} else if ((z <= 11000000000.0) || (!(z <= 5.8e+66) && (z <= 1.75e+103))) {
		tmp = x * x;
	} else {
		tmp = y * ((z * z) * -4.0);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= 2e-105:
		tmp = y * (t * 4.0)
	elif (z <= 11000000000.0) or (not (z <= 5.8e+66) and (z <= 1.75e+103)):
		tmp = x * x
	else:
		tmp = y * ((z * z) * -4.0)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= 2e-105)
		tmp = Float64(y * Float64(t * 4.0));
	elseif ((z <= 11000000000.0) || (!(z <= 5.8e+66) && (z <= 1.75e+103)))
		tmp = Float64(x * x);
	else
		tmp = Float64(y * Float64(Float64(z * z) * -4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= 2e-105)
		tmp = y * (t * 4.0);
	elseif ((z <= 11000000000.0) || (~((z <= 5.8e+66)) && (z <= 1.75e+103)))
		tmp = x * x;
	else
		tmp = y * ((z * z) * -4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, 2e-105], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 11000000000.0], And[N[Not[LessEqual[z, 5.8e+66]], $MachinePrecision], LessEqual[z, 1.75e+103]]], N[(x * x), $MachinePrecision], N[(y * N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 11000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+66}\right) \land z \leq 1.75 \cdot 10^{+103}:\\
\;\;\;\;x \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 1.99999999999999993e-105

    1. Initial program 90.5%

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

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

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

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

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

    if 1.99999999999999993e-105 < z < 1.1e10 or 5.79999999999999972e66 < z < 1.75e103

    1. Initial program 100.0%

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

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

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

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

    if 1.1e10 < z < 5.79999999999999972e66 or 1.75e103 < 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. *-commutative69.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 2 \cdot 10^{-105}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 11000000000 \lor \neg \left(z \leq 5.8 \cdot 10^{+66}\right) \land z \leq 1.75 \cdot 10^{+103}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\ \end{array} \]

Alternative 5: 45.9% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 10500000000:\\
\;\;\;\;x \cdot x\\

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

\mathbf{elif}\;z \leq 2 \cdot 10^{+103}:\\
\;\;\;\;x \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < 1.05e-105

    1. Initial program 90.5%

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

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

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

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

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

    if 1.05e-105 < z < 1.05e10 or 2.3500000000000001e66 < z < 2e103

    1. Initial program 100.0%

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

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

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

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

    if 1.05e10 < z < 2.3500000000000001e66

    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 55.7%

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

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

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

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

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

    if 2e103 < z

    1. Initial program 70.8%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u37.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)\right)} \]
      2. expm1-udef34.3%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*34.3%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr34.3%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def37.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)\right)} \]
      2. expm1-log1p73.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 1.05 \cdot 10^{-105}:\\ \;\;\;\;y \cdot \left(t \cdot 4\right)\\ \mathbf{elif}\;z \leq 10500000000:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+103}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\ \end{array} \]

Alternative 6: 77.7% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 4.10000000000000015e-24

    1. Initial program 91.6%

      \[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(t \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*l*73.9%

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

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

    if 4.10000000000000015e-24 < z < 6.8e124

    1. Initial program 99.9%

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

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

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

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

    if 6.8e124 < z

    1. Initial program 65.5%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u34.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)\right)} \]
      2. expm1-udef34.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*34.1%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr34.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def34.1%

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

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

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

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

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

Alternative 7: 78.7% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 2.05000000000000007e-24

    1. Initial program 91.6%

      \[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(t \cdot y\right)} \]
    3. Step-by-step derivation
      1. associate-*l*73.9%

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

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

    if 2.05000000000000007e-24 < z < 1.35e188

    1. Initial program 83.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. add-cube-cbrt82.6%

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \cdot \sqrt[3]{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)}} \]
      2. pow382.6%

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

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

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

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

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

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

        \[\leadsto x \cdot x - {\left(\sqrt[3]{\color{blue}{\frac{y \cdot 4}{1}}} \cdot \sqrt[3]{z \cdot z - t}\right)}^{3} \]
      2. associate-/l*82.2%

        \[\leadsto x \cdot x - {\left(\sqrt[3]{\color{blue}{\frac{y}{\frac{1}{4}}}} \cdot \sqrt[3]{z \cdot z - t}\right)}^{3} \]
      3. metadata-eval82.2%

        \[\leadsto x \cdot x - {\left(\sqrt[3]{\frac{y}{\color{blue}{0.25}}} \cdot \sqrt[3]{z \cdot z - t}\right)}^{3} \]
    7. Simplified82.2%

      \[\leadsto x \cdot x - {\color{blue}{\left(\sqrt[3]{\frac{y}{0.25}} \cdot \sqrt[3]{z \cdot z - t}\right)}}^{3} \]
    8. Taylor expanded in t around 0 72.4%

      \[\leadsto x \cdot x - \color{blue}{4 \cdot \left({1}^{0.3333333333333333} \cdot \left(y \cdot {z}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. pow-base-172.4%

        \[\leadsto x \cdot x - 4 \cdot \left(\color{blue}{1} \cdot \left(y \cdot {z}^{2}\right)\right) \]
      2. *-lft-identity72.4%

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

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

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

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

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

    if 1.35e188 < z

    1. Initial program 74.6%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\left(z \cdot z\right) \cdot -4\right)} \]
    5. Step-by-step derivation
      1. expm1-log1p-u31.2%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\right)} - 1} \]
      3. associate-*l*31.2%

        \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{\left(z \cdot \left(z \cdot -4\right)\right)}\right)} - 1 \]
    6. Applied egg-rr31.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)} - 1} \]
    7. Step-by-step derivation
      1. expm1-def31.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\right)\right)} \]
      2. expm1-log1p83.3%

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

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

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

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

Alternative 8: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5.6 \cdot 10^{+249}:\\
\;\;\;\;\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) < 5.60000000000000035e249

    1. Initial program 93.5%

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

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

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

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

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

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

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

    if 5.60000000000000035e249 < (*.f64 x x)

    1. Initial program 77.6%

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

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

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

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

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

Alternative 9: 58.5% accurate, 1.4× speedup?

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

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

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


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

    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 44.9%

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

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

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

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

    if 2.5000000000000001e91 < (*.f64 x x)

    1. Initial program 82.0%

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

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

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

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

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

Alternative 10: 40.7% accurate, 4.3× speedup?

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

\\
x \cdot x
\end{array}
Derivation
  1. Initial program 88.6%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 91.3% 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 2023293 
(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))))