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

Percentage Accurate: 90.0% → 95.7%
Time: 9.2s
Alternatives: 7
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 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.7% 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}:\\ \;\;\;\;x \cdot x - z \cdot \left(y \cdot \left(z \cdot 4\right)\right)\\ \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)))
   (- (* x x) (* z (* 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 = (x * x) - (z * (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(Float64(x * x) - Float64(z * Float64(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[(N[(x * x), $MachinePrecision] - N[(z * N[(y * N[(z * 4.0), $MachinePrecision]), $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}:\\
\;\;\;\;x \cdot x - z \cdot \left(y \cdot \left(z \cdot 4\right)\right)\\


\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. fma-neg99.4%

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

        \[\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-in99.4%

        \[\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-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) \]
      5. 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. Step-by-step derivation
      1. flip--1.5%

        \[\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}} \]
      2. associate-*r/1.5%

        \[\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}} \]
      3. pow21.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{{\left(z \cdot z\right)}^{2}} - t \cdot t\right)}{z \cdot z + t} \]
      4. metadata-eval1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({\left(z \cdot z\right)}^{\color{blue}{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      5. pow-prod-down1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{{z}^{\left(\sqrt{4}\right)} \cdot {z}^{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      6. pow-prod-up1.5%

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

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{\left(\color{blue}{2} + \sqrt{4}\right)} - t \cdot t\right)}{z \cdot z + t} \]
      8. metadata-eval1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{\left(2 + \color{blue}{2}\right)} - t \cdot t\right)}{z \cdot z + t} \]
      9. metadata-eval1.5%

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

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

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

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

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

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

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. unpow269.5%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{z \cdot z}}} \]
    8. Simplified69.5%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{z \cdot z}}} \]
    9. Step-by-step derivation
      1. pow269.5%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{{z}^{2}}}} \]
      2. metadata-eval69.5%

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

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

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

        \[\leadsto x \cdot x - \frac{4 \cdot y}{{z}^{\color{blue}{-2}}} \]
    10. Applied egg-rr71.2%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{{z}^{-2}}} \]
    11. Taylor expanded in y around 0 69.5%

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

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

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

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

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

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

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

    \[\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}:\\ \;\;\;\;x \cdot x - z \cdot \left(y \cdot \left(z \cdot 4\right)\right)\\ \end{array} \]

Alternative 2: 58.5% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 1.3e-308 or 2.00000000000000002e-50 < (*.f64 z z) < 2.55000000000000011e57

    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 1.3e-308 < (*.f64 z z) < 2.00000000000000002e-50

    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 2.55000000000000011e57 < (*.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. *-commutative70.1%

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

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

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

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

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

Alternative 3: 95.2% accurate, 0.8× speedup?

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

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

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


\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) \]

    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. Step-by-step derivation
      1. flip--1.5%

        \[\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}} \]
      2. associate-*r/1.5%

        \[\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}} \]
      3. pow21.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{{\left(z \cdot z\right)}^{2}} - t \cdot t\right)}{z \cdot z + t} \]
      4. metadata-eval1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({\left(z \cdot z\right)}^{\color{blue}{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      5. pow-prod-down1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{{z}^{\left(\sqrt{4}\right)} \cdot {z}^{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      6. pow-prod-up1.5%

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

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{\left(\color{blue}{2} + \sqrt{4}\right)} - t \cdot t\right)}{z \cdot z + t} \]
      8. metadata-eval1.5%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({z}^{\left(2 + \color{blue}{2}\right)} - t \cdot t\right)}{z \cdot z + t} \]
      9. metadata-eval1.5%

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

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

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

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

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

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

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. unpow269.5%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{z \cdot z}}} \]
    8. Simplified69.5%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{z \cdot z}}} \]
    9. Step-by-step derivation
      1. pow269.5%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{{z}^{2}}}} \]
      2. metadata-eval69.5%

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

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

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

        \[\leadsto x \cdot x - \frac{4 \cdot y}{{z}^{\color{blue}{-2}}} \]
    10. Applied egg-rr71.2%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{{z}^{-2}}} \]
    11. Taylor expanded in y around 0 69.5%

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

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

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

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

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

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

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

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

Alternative 4: 89.8% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 z z) < 1.99999999999999985e-24

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

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

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

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

    if 1.99999999999999985e-24 < (*.f64 z z)

    1. Initial program 81.0%

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

        \[\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}} \]
      2. associate-*r/25.1%

        \[\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}} \]
      3. pow225.1%

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

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left({\left(z \cdot z\right)}^{\color{blue}{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      5. pow-prod-down25.1%

        \[\leadsto x \cdot x - \frac{\left(y \cdot 4\right) \cdot \left(\color{blue}{{z}^{\left(\sqrt{4}\right)} \cdot {z}^{\left(\sqrt{4}\right)}} - t \cdot t\right)}{z \cdot z + t} \]
      6. pow-prod-up25.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{{z}^{2}}}} \]
    7. Step-by-step derivation
      1. unpow276.2%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{z \cdot z}}} \]
    8. Simplified76.2%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{1}{z \cdot z}}} \]
    9. Step-by-step derivation
      1. pow276.2%

        \[\leadsto x \cdot x - \frac{4 \cdot y}{\frac{1}{\color{blue}{{z}^{2}}}} \]
      2. metadata-eval76.2%

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

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

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

        \[\leadsto x \cdot x - \frac{4 \cdot y}{{z}^{\color{blue}{-2}}} \]
    10. Applied egg-rr77.2%

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{{z}^{-2}}} \]
    11. Taylor expanded in y around 0 76.2%

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

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

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

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

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

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

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

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

Alternative 5: 81.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \cdot z \leq 2.55 \cdot 10^{+76}:\\ \;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(z \cdot z\right) \cdot -4\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* z z) 2.55e+76)
   (- (* 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) <= 2.55e+76) {
		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) <= 2.55d+76) 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) <= 2.55e+76) {
		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) <= 2.55e+76:
		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) <= 2.55e+76)
		tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0)));
	else
		tmp = Float64(y * Float64(Float64(z * z) * -4.0));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((z * z) <= 2.55e+76)
		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], 2.55e+76], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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} \]
    4. Simplified93.6%

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

    if 2.5500000000000001e76 < (*.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. *-commutative71.5%

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

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

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

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

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

Alternative 6: 44.7% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{+37}:\\
\;\;\;\;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 < 4.49999999999999962e37

    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 4.49999999999999962e37 < 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 4.5 \cdot 10^{+37}:\\ \;\;\;\;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))))