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

Percentage Accurate: 91.2% → 96.6%
Time: 7.4s
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: 91.2% accurate, 1.0× speedup?

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

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

Alternative 1: 96.6% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 97.8%

      \[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 9.99999999999999921e273 < (*.f64 z z)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

Alternative 2: 86.8% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

    if 2.75000000000000026e-66 < (*.f64 x x) < 5e307

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

    if 5e307 < (*.f64 x 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 91.9%

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

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

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

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

Alternative 3: 96.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 97.8%

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

    if 9.99999999999999921e273 < (*.f64 z z)

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

Alternative 4: 57.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{+34}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-33}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 7.3 \cdot 10^{+39}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* -4.0 (* (* z z) y))))
   (if (<= z -5.2e+130)
     t_1
     (if (<= z -4.5e+34)
       (* x x)
       (if (<= z -1.2e-33) (* t (* y 4.0)) (if (<= z 7.3e+39) (* x x) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = -4.0 * ((z * z) * y);
	double tmp;
	if (z <= -5.2e+130) {
		tmp = t_1;
	} else if (z <= -4.5e+34) {
		tmp = x * x;
	} else if (z <= -1.2e-33) {
		tmp = t * (y * 4.0);
	} else if (z <= 7.3e+39) {
		tmp = x * x;
	} else {
		tmp = t_1;
	}
	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 (z <= (-5.2d+130)) then
        tmp = t_1
    else if (z <= (-4.5d+34)) then
        tmp = x * x
    else if (z <= (-1.2d-33)) then
        tmp = t * (y * 4.0d0)
    else if (z <= 7.3d+39) then
        tmp = x * x
    else
        tmp = t_1
    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 (z <= -5.2e+130) {
		tmp = t_1;
	} else if (z <= -4.5e+34) {
		tmp = x * x;
	} else if (z <= -1.2e-33) {
		tmp = t * (y * 4.0);
	} else if (z <= 7.3e+39) {
		tmp = x * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -4.0 * ((z * z) * y)
	tmp = 0
	if z <= -5.2e+130:
		tmp = t_1
	elif z <= -4.5e+34:
		tmp = x * x
	elif z <= -1.2e-33:
		tmp = t * (y * 4.0)
	elif z <= 7.3e+39:
		tmp = x * x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(-4.0 * Float64(Float64(z * z) * y))
	tmp = 0.0
	if (z <= -5.2e+130)
		tmp = t_1;
	elseif (z <= -4.5e+34)
		tmp = Float64(x * x);
	elseif (z <= -1.2e-33)
		tmp = Float64(t * Float64(y * 4.0));
	elseif (z <= 7.3e+39)
		tmp = Float64(x * x);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -4.0 * ((z * z) * y);
	tmp = 0.0;
	if (z <= -5.2e+130)
		tmp = t_1;
	elseif (z <= -4.5e+34)
		tmp = x * x;
	elseif (z <= -1.2e-33)
		tmp = t * (y * 4.0);
	elseif (z <= 7.3e+39)
		tmp = x * x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+130], t$95$1, If[LessEqual[z, -4.5e+34], N[(x * x), $MachinePrecision], If[LessEqual[z, -1.2e-33], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.3e+39], N[(x * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -4.5 \cdot 10^{+34}:\\
\;\;\;\;x \cdot x\\

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

\mathbf{elif}\;z \leq 7.3 \cdot 10^{+39}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.1999999999999996e130 or 7.3e39 < z

    1. Initial program 80.1%

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

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

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

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

    if -5.1999999999999996e130 < z < -4.5e34 or -1.2e-33 < z < 7.3e39

    1. Initial program 97.3%

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

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

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

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

    if -4.5e34 < z < -1.2e-33

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+130}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{+34}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-33}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 7.3 \cdot 10^{+39}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \end{array} \]

Alternative 5: 60.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z \leq -9.5 \cdot 10^{+34}:\\
\;\;\;\;x \cdot x\\

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

\mathbf{elif}\;z \leq 7.2 \cdot 10^{+39}:\\
\;\;\;\;x \cdot x\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.4999999999999997e130 or 7.19999999999999969e39 < z

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.4999999999999997e130 < z < -9.4999999999999999e34 or -1.2e-33 < z < 7.19999999999999969e39

    1. Initial program 97.3%

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

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

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

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

    if -9.4999999999999999e34 < z < -1.2e-33

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+130}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{elif}\;z \leq -9.5 \cdot 10^{+34}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-33}:\\ \;\;\;\;t \cdot \left(y \cdot 4\right)\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{+39}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \end{array} \]

Alternative 6: 83.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+130} \lor \neg \left(z \leq 1.4 \cdot 10^{+47}\right):\\ \;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= z -5.2e+130) (not (<= z 1.4e+47)))
   (* z (* z (* y -4.0)))
   (- (* x x) (* t (* y -4.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -5.2e+130) || !(z <= 1.4e+47)) {
		tmp = z * (z * (y * -4.0));
	} else {
		tmp = (x * x) - (t * (y * -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 <= (-5.2d+130)) .or. (.not. (z <= 1.4d+47))) then
        tmp = z * (z * (y * (-4.0d0)))
    else
        tmp = (x * x) - (t * (y * (-4.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -5.2e+130) || !(z <= 1.4e+47)) {
		tmp = z * (z * (y * -4.0));
	} else {
		tmp = (x * x) - (t * (y * -4.0));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -5.2e+130) or not (z <= 1.4e+47):
		tmp = z * (z * (y * -4.0))
	else:
		tmp = (x * x) - (t * (y * -4.0))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((z <= -5.2e+130) || !(z <= 1.4e+47))
		tmp = Float64(z * Float64(z * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z <= -5.2e+130) || ~((z <= 1.4e+47)))
		tmp = z * (z * (y * -4.0));
	else
		tmp = (x * x) - (t * (y * -4.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+130], N[Not[LessEqual[z, 1.4e+47]], $MachinePrecision]], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+130} \lor \neg \left(z \leq 1.4 \cdot 10^{+47}\right):\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.1999999999999996e130 or 1.39999999999999994e47 < z

    1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1999999999999996e130 < z < 1.39999999999999994e47

    1. Initial program 97.6%

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

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

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

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

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

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

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

Alternative 7: 80.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{+74}:\\ \;\;\;\;\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) 1e+74) (* (- (* z z) t) (* y -4.0)) (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 1e+74) {
		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) <= 1d+74) 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) <= 1e+74) {
		tmp = ((z * z) - t) * (y * -4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x * x) <= 1e+74:
		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) <= 1e+74)
		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) <= 1e+74)
		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], 1e+74], 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 10^{+74}:\\
\;\;\;\;\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) < 9.99999999999999952e73

    1. Initial program 94.9%

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

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

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

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

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

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

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

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

    if 9.99999999999999952e73 < (*.f64 x x)

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

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

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

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

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

Alternative 8: 58.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-66}:\\ \;\;\;\;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.2e-66) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 1.2e-66) {
		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.2d-66) 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.2e-66) {
		tmp = t * (y * 4.0);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x * x) <= 1.2e-66:
		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.2e-66)
		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.2e-66)
		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.2e-66], 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.2 \cdot 10^{-66}:\\
\;\;\;\;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.20000000000000013e-66

    1. Initial program 93.1%

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

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

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

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

    if 1.20000000000000013e-66 < (*.f64 x x)

    1. Initial program 90.3%

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

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

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

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

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

Alternative 9: 41.9% 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 91.3%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 91.2% accurate, 1.0× speedup?

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

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

Reproduce

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