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

Percentage Accurate: 89.9% → 95.4%
Time: 6.7s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 89.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.4% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 96.1%

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

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

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

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

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

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

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

    if 2.0000000000000002e302 < (*.f64 z z)

    1. Initial program 58.3%

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

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

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

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

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

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

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

Alternative 2: 83.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \cdot z \leq 2000000000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+113}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+233}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 9.99999999999999927e-77 or 2e12 < (*.f64 z z) < 5e113 or 2.00000000000000007e154 < (*.f64 z z) < 3.99999999999999989e233

    1. Initial program 95.7%

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

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

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

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

    if 9.99999999999999927e-77 < (*.f64 z z) < 2e12 or 5e113 < (*.f64 z z) < 2.00000000000000007e154

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

    if 3.99999999999999989e233 < (*.f64 z z)

    1. Initial program 63.3%

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

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

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

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

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

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

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

Alternative 3: 80.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.7 \cdot 10^{+72} \lor \neg \left(x \cdot x \leq 6.8 \cdot 10^{+105}\right) \land x \cdot x \leq 4.2 \cdot 10^{+187}:\\
\;\;\;\;\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) < 2.7000000000000001e72 or 6.7999999999999999e105 < (*.f64 x x) < 4.2e187

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

    if 2.7000000000000001e72 < (*.f64 x x) < 6.7999999999999999e105 or 4.2e187 < (*.f64 x x)

    1. Initial program 76.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2.7 \cdot 10^{+72} \lor \neg \left(x \cdot x \leq 6.8 \cdot 10^{+105}\right) \land x \cdot x \leq 4.2 \cdot 10^{+187}:\\ \;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 4: 94.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 96.1%

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

    if 2.0000000000000002e302 < (*.f64 z z)

    1. Initial program 58.3%

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

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

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

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

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

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

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

Alternative 5: 44.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 6.6 \cdot 10^{+56} \lor \neg \left(z \leq 4.8 \cdot 10^{+83}\right) \land z \leq 6.6 \cdot 10^{+116}:\\
\;\;\;\;x \cdot x\\

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


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

    1. Initial program 83.6%

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

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

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

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

    if 3.0000000000000002e-259 < z < 6.60000000000000004e56 or 4.79999999999999982e83 < z < 6.5999999999999996e116

    1. Initial program 97.0%

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

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

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

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

    if 6.60000000000000004e56 < z < 4.79999999999999982e83 or 6.5999999999999996e116 < z

    1. Initial program 73.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3 \cdot 10^{-259}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{+56} \lor \neg \left(z \leq 4.8 \cdot 10^{+83}\right) \land z \leq 6.6 \cdot 10^{+116}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \]

Alternative 6: 45.9% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq 7.8 \cdot 10^{+56}:\\
\;\;\;\;x \cdot x\\

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

\mathbf{elif}\;z \leq 5.3 \cdot 10^{+116}:\\
\;\;\;\;x \cdot x\\

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


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

    1. Initial program 83.6%

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

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

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

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

    if 3.8e-259 < z < 7.79999999999999989e56 or 3.30000000000000017e84 < z < 5.3000000000000002e116

    1. Initial program 97.0%

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

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

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

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

    if 7.79999999999999989e56 < z < 3.30000000000000017e84

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

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

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

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

    if 5.3000000000000002e116 < z

    1. Initial program 70.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq 3.8 \cdot 10^{-259}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+56}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+84}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;z \leq 5.3 \cdot 10^{+116}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\ \end{array} \]

Alternative 7: 59.6% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.7 \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) < 1.7e-23

    1. Initial program 91.8%

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

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

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

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

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

    1. Initial program 78.8%

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

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

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

      \[\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 1.7 \cdot 10^{-23}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 8: 41.3% 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 85.2%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 89.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 2023207 
(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))))