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

Percentage Accurate: 90.0% → 95.1%
Time: 11.6s
Alternatives: 7
Speedup: 0.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 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.0% 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.1% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{\frac{1}{y}}{z \cdot -4}}\\


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

    1. Initial program 98.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. associate-*l*98.8%

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e267 < (*.f64 z z)

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{1} \cdot \left(-4 \cdot \color{blue}{\frac{1}{\frac{1}{z \cdot z}}}\right) \]
      5. un-div-inv72.1%

        \[\leadsto \frac{y}{1} \cdot \color{blue}{\frac{-4}{\frac{1}{z \cdot z}}} \]
      6. times-frac72.1%

        \[\leadsto \color{blue}{\frac{y \cdot -4}{1 \cdot \frac{1}{z \cdot z}}} \]
      7. metadata-eval72.1%

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

        \[\leadsto \frac{\color{blue}{-y \cdot 4}}{1 \cdot \frac{1}{z \cdot z}} \]
      9. div-inv72.1%

        \[\leadsto \frac{-y \cdot 4}{\color{blue}{\frac{1}{z \cdot z}}} \]
      10. distribute-neg-frac72.1%

        \[\leadsto \color{blue}{-\frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      11. neg-sub072.1%

        \[\leadsto \color{blue}{0 - \frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      12. associate-/r*73.7%

        \[\leadsto 0 - \frac{y \cdot 4}{\color{blue}{\frac{\frac{1}{z}}{z}}} \]
      13. associate-/r/88.6%

        \[\leadsto 0 - \color{blue}{\frac{y \cdot 4}{\frac{1}{z}} \cdot z} \]
      14. cancel-sign-sub-inv88.6%

        \[\leadsto \color{blue}{0 + \left(-\frac{y \cdot 4}{\frac{1}{z}}\right) \cdot z} \]
      15. div-inv88.6%

        \[\leadsto 0 + \left(-\color{blue}{\left(y \cdot 4\right) \cdot \frac{1}{\frac{1}{z}}}\right) \cdot z \]
      16. remove-double-div88.6%

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

      \[\leadsto \color{blue}{0 + \left(-\left(y \cdot 4\right) \cdot z\right) \cdot z} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in88.6%

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

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

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

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

        \[\leadsto 0 + \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
      6. *-commutative72.1%

        \[\leadsto 0 + \color{blue}{\left(-4 \cdot \left(z \cdot z\right)\right) \cdot y} \]
      7. remove-double-div72.1%

        \[\leadsto 0 + \left(-4 \cdot \left(z \cdot z\right)\right) \cdot \color{blue}{\frac{1}{\frac{1}{y}}} \]
      8. div-inv72.1%

        \[\leadsto 0 + \color{blue}{\frac{-4 \cdot \left(z \cdot z\right)}{\frac{1}{y}}} \]
      9. associate-*r*72.1%

        \[\leadsto 0 + \frac{\color{blue}{\left(-4 \cdot z\right) \cdot z}}{\frac{1}{y}} \]
      10. *-commutative72.1%

        \[\leadsto 0 + \frac{\color{blue}{z \cdot \left(-4 \cdot z\right)}}{\frac{1}{y}} \]
      11. associate-/l*88.7%

        \[\leadsto 0 + \color{blue}{\frac{z}{\frac{\frac{1}{y}}{-4 \cdot z}}} \]
      12. *-commutative88.7%

        \[\leadsto 0 + \frac{z}{\frac{\frac{1}{y}}{\color{blue}{z \cdot -4}}} \]
    8. Applied egg-rr88.7%

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

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

Alternative 2: 58.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-308}:\\
\;\;\;\;x \cdot x\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 9.9999999999999991e-309 or 9.99999999999999995e-56 < (*.f64 z z) < 1.00000000000000009e56

    1. Initial program 100.0%

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

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

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

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

    if 9.9999999999999991e-309 < (*.f64 z z) < 9.99999999999999995e-56

    1. Initial program 99.9%

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

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

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

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

    if 1.00000000000000009e56 < (*.f64 z z)

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 92.3% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{\frac{1}{y}}{z \cdot -4}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 3.69999999999999992e139

    1. Initial program 94.1%

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

    if 3.69999999999999992e139 < z

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{1} \cdot \left(-4 \cdot \color{blue}{\frac{1}{\frac{1}{z \cdot z}}}\right) \]
      5. un-div-inv69.1%

        \[\leadsto \frac{y}{1} \cdot \color{blue}{\frac{-4}{\frac{1}{z \cdot z}}} \]
      6. times-frac69.1%

        \[\leadsto \color{blue}{\frac{y \cdot -4}{1 \cdot \frac{1}{z \cdot z}}} \]
      7. metadata-eval69.1%

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

        \[\leadsto \frac{\color{blue}{-y \cdot 4}}{1 \cdot \frac{1}{z \cdot z}} \]
      9. div-inv69.1%

        \[\leadsto \frac{-y \cdot 4}{\color{blue}{\frac{1}{z \cdot z}}} \]
      10. distribute-neg-frac69.1%

        \[\leadsto \color{blue}{-\frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      11. neg-sub069.1%

        \[\leadsto \color{blue}{0 - \frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      12. associate-/r*70.2%

        \[\leadsto 0 - \frac{y \cdot 4}{\color{blue}{\frac{\frac{1}{z}}{z}}} \]
      13. associate-/r/81.8%

        \[\leadsto 0 - \color{blue}{\frac{y \cdot 4}{\frac{1}{z}} \cdot z} \]
      14. cancel-sign-sub-inv81.8%

        \[\leadsto \color{blue}{0 + \left(-\frac{y \cdot 4}{\frac{1}{z}}\right) \cdot z} \]
      15. div-inv81.9%

        \[\leadsto 0 + \left(-\color{blue}{\left(y \cdot 4\right) \cdot \frac{1}{\frac{1}{z}}}\right) \cdot z \]
      16. remove-double-div81.9%

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

      \[\leadsto \color{blue}{0 + \left(-\left(y \cdot 4\right) \cdot z\right) \cdot z} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in81.9%

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

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

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

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

        \[\leadsto 0 + \color{blue}{y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)} \]
      6. *-commutative69.1%

        \[\leadsto 0 + \color{blue}{\left(-4 \cdot \left(z \cdot z\right)\right) \cdot y} \]
      7. remove-double-div69.1%

        \[\leadsto 0 + \left(-4 \cdot \left(z \cdot z\right)\right) \cdot \color{blue}{\frac{1}{\frac{1}{y}}} \]
      8. div-inv69.1%

        \[\leadsto 0 + \color{blue}{\frac{-4 \cdot \left(z \cdot z\right)}{\frac{1}{y}}} \]
      9. associate-*r*69.1%

        \[\leadsto 0 + \frac{\color{blue}{\left(-4 \cdot z\right) \cdot z}}{\frac{1}{y}} \]
      10. *-commutative69.1%

        \[\leadsto 0 + \frac{\color{blue}{z \cdot \left(-4 \cdot z\right)}}{\frac{1}{y}} \]
      11. associate-/l*81.9%

        \[\leadsto 0 + \color{blue}{\frac{z}{\frac{\frac{1}{y}}{-4 \cdot z}}} \]
      12. *-commutative81.9%

        \[\leadsto 0 + \frac{z}{\frac{\frac{1}{y}}{\color{blue}{z \cdot -4}}} \]
    8. Applied egg-rr81.9%

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

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

Alternative 4: 81.1% accurate, 1.0× speedup?

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

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

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


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

    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 0 93.6%

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

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

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

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

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

    if 4.99999999999999963e74 < (*.f64 z z)

    1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 75.1% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.05e38

    1. Initial program 94.0%

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

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

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

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

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

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

    if 1.05e38 < z

    1. Initial program 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{1} \cdot \color{blue}{\left(-4 \cdot \left(z \cdot z\right)\right)} \]
      4. remove-double-div67.2%

        \[\leadsto \frac{y}{1} \cdot \left(-4 \cdot \color{blue}{\frac{1}{\frac{1}{z \cdot z}}}\right) \]
      5. un-div-inv67.2%

        \[\leadsto \frac{y}{1} \cdot \color{blue}{\frac{-4}{\frac{1}{z \cdot z}}} \]
      6. times-frac67.2%

        \[\leadsto \color{blue}{\frac{y \cdot -4}{1 \cdot \frac{1}{z \cdot z}}} \]
      7. metadata-eval67.2%

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

        \[\leadsto \frac{\color{blue}{-y \cdot 4}}{1 \cdot \frac{1}{z \cdot z}} \]
      9. div-inv67.2%

        \[\leadsto \frac{-y \cdot 4}{\color{blue}{\frac{1}{z \cdot z}}} \]
      10. distribute-neg-frac67.2%

        \[\leadsto \color{blue}{-\frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      11. neg-sub067.2%

        \[\leadsto \color{blue}{0 - \frac{y \cdot 4}{\frac{1}{z \cdot z}}} \]
      12. associate-/r*67.8%

        \[\leadsto 0 - \frac{y \cdot 4}{\color{blue}{\frac{\frac{1}{z}}{z}}} \]
      13. associate-/r/75.6%

        \[\leadsto 0 - \color{blue}{\frac{y \cdot 4}{\frac{1}{z}} \cdot z} \]
      14. cancel-sign-sub-inv75.6%

        \[\leadsto \color{blue}{0 + \left(-\frac{y \cdot 4}{\frac{1}{z}}\right) \cdot z} \]
      15. div-inv75.7%

        \[\leadsto 0 + \left(-\color{blue}{\left(y \cdot 4\right) \cdot \frac{1}{\frac{1}{z}}}\right) \cdot z \]
      16. remove-double-div75.7%

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

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

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

Alternative 6: 44.7% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.35e36

    1. Initial program 90.4%

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

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

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

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

    if 1.35e36 < x

    1. Initial program 88.2%

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

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

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

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

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

Alternative 7: 41.0% 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 89.9%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 90.1% 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 2023297 
(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))))