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

Percentage Accurate: 90.7% → 96.2%
Time: 9.1s
Alternatives: 9
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

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

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 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) 1e+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) <= 1e+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) <= 1e+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], 1e+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 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) < 1.0000000000000001e302

    1. Initial program 96.3%

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

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

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

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

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

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

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

    if 1.0000000000000001e302 < (*.f64 z z)

    1. Initial program 62.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 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: 89.0% accurate, 0.7× speedup?

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

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

\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) < 5e11

    1. Initial program 98.3%

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

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

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

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

    if 5e11 < (*.f64 z z) < 4.0000000000000002e276

    1. Initial program 94.8%

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

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

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

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

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

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

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

    if 4.0000000000000002e276 < (*.f64 z z)

    1. Initial program 64.6%

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

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

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

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

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

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

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

Alternative 3: 95.0% accurate, 0.8× speedup?

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

    1. Initial program 97.2%

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

    if 4.0000000000000002e276 < (*.f64 z z)

    1. Initial program 64.6%

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

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

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

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

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

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

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

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\ \mathbf{if}\;x \leq -2.35 \cdot 10^{+82}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-162}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 2400000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* -4.0 (* z (* z y)))))
   (if (<= x -2.35e+82)
     (* x x)
     (if (<= x -1.5e-181)
       t_1
       (if (<= x 3.1e-162)
         (* t (* y 4.0))
         (if (<= x 2400000000000.0) t_1 (* x x)))))))
double code(double x, double y, double z, double t) {
	double t_1 = -4.0 * (z * (z * y));
	double tmp;
	if (x <= -2.35e+82) {
		tmp = x * x;
	} else if (x <= -1.5e-181) {
		tmp = t_1;
	} else if (x <= 3.1e-162) {
		tmp = t * (y * 4.0);
	} else if (x <= 2400000000000.0) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = (-4.0d0) * (z * (z * y))
    if (x <= (-2.35d+82)) then
        tmp = x * x
    else if (x <= (-1.5d-181)) then
        tmp = t_1
    else if (x <= 3.1d-162) then
        tmp = t * (y * 4.0d0)
    else if (x <= 2400000000000.0d0) then
        tmp = t_1
    else
        tmp = x * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = -4.0 * (z * (z * y));
	double tmp;
	if (x <= -2.35e+82) {
		tmp = x * x;
	} else if (x <= -1.5e-181) {
		tmp = t_1;
	} else if (x <= 3.1e-162) {
		tmp = t * (y * 4.0);
	} else if (x <= 2400000000000.0) {
		tmp = t_1;
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -4.0 * (z * (z * y))
	tmp = 0
	if x <= -2.35e+82:
		tmp = x * x
	elif x <= -1.5e-181:
		tmp = t_1
	elif x <= 3.1e-162:
		tmp = t * (y * 4.0)
	elif x <= 2400000000000.0:
		tmp = t_1
	else:
		tmp = x * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(-4.0 * Float64(z * Float64(z * y)))
	tmp = 0.0
	if (x <= -2.35e+82)
		tmp = Float64(x * x);
	elseif (x <= -1.5e-181)
		tmp = t_1;
	elseif (x <= 3.1e-162)
		tmp = Float64(t * Float64(y * 4.0));
	elseif (x <= 2400000000000.0)
		tmp = t_1;
	else
		tmp = Float64(x * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -4.0 * (z * (z * y));
	tmp = 0.0;
	if (x <= -2.35e+82)
		tmp = x * x;
	elseif (x <= -1.5e-181)
		tmp = t_1;
	elseif (x <= 3.1e-162)
		tmp = t * (y * 4.0);
	elseif (x <= 2400000000000.0)
		tmp = t_1;
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.35e+82], N[(x * x), $MachinePrecision], If[LessEqual[x, -1.5e-181], t$95$1, If[LessEqual[x, 3.1e-162], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2400000000000.0], t$95$1, N[(x * x), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq -1.5 \cdot 10^{-181}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \leq 2400000000000:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.35e82 or 2.4e12 < x

    1. Initial program 80.9%

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

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

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

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

    if -2.35e82 < x < -1.49999999999999987e-181 or 3.0999999999999999e-162 < x < 2.4e12

    1. Initial program 92.6%

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

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

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

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

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

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

    if -1.49999999999999987e-181 < x < 3.0999999999999999e-162

    1. Initial program 97.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.35 \cdot 10^{+82}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-181}:\\ \;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-162}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;x \leq 2400000000000:\\ \;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 5: 90.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 500000000000:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - z \cdot \frac{y}{\frac{0.25}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 500000000000.0)
   (- (* x x) (* t (* y -4.0)))
   (- (* x x) (* z (/ y (/ 0.25 z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 500000000000.0) {
		tmp = (x * x) - (t * (y * -4.0));
	} else {
		tmp = (x * x) - (z * (y / (0.25 / z)));
	}
	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) <= 500000000000.0d0) then
        tmp = (x * x) - (t * (y * (-4.0d0)))
    else
        tmp = (x * x) - (z * (y / (0.25d0 / z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z * z) <= 500000000000.0) {
		tmp = (x * x) - (t * (y * -4.0));
	} else {
		tmp = (x * x) - (z * (y / (0.25 / z)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * z) <= 500000000000.0:
		tmp = (x * x) - (t * (y * -4.0))
	else:
		tmp = (x * x) - (z * (y / (0.25 / z)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(z * z) <= 500000000000.0)
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x * x) - Float64(z * Float64(y / Float64(0.25 / z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * z) <= 500000000000.0)
		tmp = (x * x) - (t * (y * -4.0));
	else
		tmp = (x * x) - (z * (y / (0.25 / z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 500000000000.0], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(y / N[(0.25 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \frac{y}{\frac{0.25}{z}}\\


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

    1. Initial program 98.3%

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

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

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

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

    if 5e11 < (*.f64 z z)

    1. Initial program 78.0%

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

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} + -1 \cdot t\right) \]
      2. neg-mul-178.0%

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

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

      \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\mathsf{fma}\left(z, z, -t\right)} \]
    5. Step-by-step derivation
      1. fma-neg78.0%

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

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\frac{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}{z \cdot z + t}} \]
      3. associate-*r/21.0%

        \[\leadsto x \cdot x - \color{blue}{\frac{\left(y \cdot 4\right) \cdot \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t\right)}{z \cdot z + t}} \]
      4. difference-of-squares25.7%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \color{blue}{\left(\left(z \cdot z + t\right) \cdot \left(z \cdot z - t\right)\right)}}{z \cdot z + t} \]
      5. fma-def25.7%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{\mathsf{fma}\left(z, z, t\right)} \cdot \left(z \cdot z - t\right)\right)}{z \cdot z + t} \]
      6. add-sqr-sqrt11.6%

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

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

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\mathsf{fma}\left(z, z, \sqrt{\color{blue}{\left(-t\right) \cdot \left(-t\right)}}\right) \cdot \left(z \cdot z - t\right)\right)}{z \cdot z + t} \]
      9. sqrt-unprod11.8%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right) \cdot \left(z \cdot z - t\right)\right)}{z \cdot z + t} \]
      10. add-sqr-sqrt21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\mathsf{fma}\left(z, z, \color{blue}{-t}\right) \cdot \left(z \cdot z - t\right)\right)}{z \cdot z + t} \]
      11. fma-neg21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\mathsf{fma}\left(z, z, -t\right) \cdot \color{blue}{\mathsf{fma}\left(z, z, -t\right)}\right)}{z \cdot z + t} \]
      12. pow221.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \color{blue}{{\left(\mathsf{fma}\left(z, z, -t\right)\right)}^{2}}}{z \cdot z + t} \]
      13. add-sqr-sqrt11.8%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, \color{blue}{\sqrt{-t} \cdot \sqrt{-t}}\right)\right)}^{2}}{z \cdot z + t} \]
      14. sqrt-unprod21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, \color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}\right)\right)}^{2}}{z \cdot z + t} \]
      15. sqr-neg21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, \sqrt{\color{blue}{t \cdot t}}\right)\right)}^{2}}{z \cdot z + t} \]
      16. sqrt-unprod9.3%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, \color{blue}{\sqrt{t} \cdot \sqrt{t}}\right)\right)}^{2}}{z \cdot z + t} \]
      17. add-sqr-sqrt21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, \color{blue}{t}\right)\right)}^{2}}{z \cdot z + t} \]
      18. fma-def21.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, t\right)\right)}^{2}}{\color{blue}{\mathsf{fma}\left(z, z, t\right)}} \]
    6. Applied egg-rr21.1%

      \[\leadsto x \cdot x - \color{blue}{\frac{\left(y \cdot 4\right) \cdot {\left(\mathsf{fma}\left(z, z, t\right)\right)}^{2}}{\mathsf{fma}\left(z, z, t\right)}} \]
    7. Step-by-step derivation
      1. associate-/l*26.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{\mathsf{fma}\left(z, z, t\right)}{{\left(\mathsf{fma}\left(z, z, t\right)\right)}^{2}}}} \]
      2. associate-/l*26.5%

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

        \[\leadsto x \cdot x - \frac{y}{\frac{\frac{\mathsf{fma}\left(z, z, t\right)}{\color{blue}{\mathsf{fma}\left(z, z, t\right) \cdot \mathsf{fma}\left(z, z, t\right)}}}{4}} \]
      4. associate-/r*41.6%

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

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

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{\frac{1}{\mathsf{fma}\left(z, z, t\right)}}{4}}} \]
    9. Taylor expanded in z around inf 73.2%

      \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{0.25}{{z}^{2}}}} \]
    10. Step-by-step derivation
      1. unpow273.2%

        \[\leadsto x \cdot x - \frac{y}{\frac{0.25}{\color{blue}{z \cdot z}}} \]
    11. Simplified73.2%

      \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{0.25}{z \cdot z}}} \]
    12. Step-by-step derivation
      1. associate-/r*74.3%

        \[\leadsto x \cdot x - \frac{y}{\color{blue}{\frac{\frac{0.25}{z}}{z}}} \]
      2. associate-/r/83.1%

        \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{0.25}{z}} \cdot z} \]
    13. Applied egg-rr83.1%

      \[\leadsto x \cdot x - \color{blue}{\frac{y}{\frac{0.25}{z}} \cdot z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 500000000000:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - z \cdot \frac{y}{\frac{0.25}{z}}\\ \end{array} \]

Alternative 6: 78.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq 5.8 \cdot 10^{-28}:\\
\;\;\;\;\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 x < -4.20000000000000005e83 or 5.80000000000000026e-28 < x

    1. Initial program 80.5%

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

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

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

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

    if -4.20000000000000005e83 < x < 5.80000000000000026e-28

    1. Initial program 95.4%

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

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

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

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

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

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

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

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

Alternative 7: 84.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+225}:\\ \;\;\;\;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} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 2e+225) (- (* x x) (* 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+225) {
		tmp = (x * x) - (t * (y * -4.0));
	} 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+225) then
        tmp = (x * x) - (t * (y * (-4.0d0)))
    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+225) {
		tmp = (x * x) - (t * (y * -4.0));
	} else {
		tmp = -4.0 * (z * (z * y));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z * z) <= 2e+225:
		tmp = (x * x) - (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+225)
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0)));
	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+225)
		tmp = (x * x) - (t * (y * -4.0));
	else
		tmp = -4.0 * (z * (z * y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+225], N[(N[(x * x), $MachinePrecision] - N[(t * 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^{+225}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 1.99999999999999986e225

    1. Initial program 98.2%

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

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

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

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

    if 1.99999999999999986e225 < (*.f64 z z)

    1. Initial program 67.2%

      \[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. unpow273.2%

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

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

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

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

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

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+80}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{-59}:\\
\;\;\;\;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 x < -7.49999999999999994e80 or 6.3999999999999998e-59 < x

    1. Initial program 81.5%

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

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

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

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

    if -7.49999999999999994e80 < x < 6.3999999999999998e-59

    1. Initial program 95.1%

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

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

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

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

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

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

Alternative 9: 40.2% 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 87.8%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 90.8% 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 2023182 
(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))))