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

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

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

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

Alternative 1: 96.6% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 97.7%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv97.7%

        \[\leadsto \color{blue}{x \cdot x + \left(-y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      2. distribute-lft-neg-out97.7%

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

        \[\leadsto \color{blue}{\left(\left(-y\right) \cdot 4\right) \cdot \left(z \cdot z - t\right) + x \cdot x} \]
      4. distribute-lft-neg-out97.7%

        \[\leadsto \color{blue}{\left(-y \cdot 4\right)} \cdot \left(z \cdot z - t\right) + x \cdot x \]
      5. distribute-lft-neg-in97.7%

        \[\leadsto \color{blue}{\left(-\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)} + x \cdot x \]
      6. distribute-rgt-neg-in97.7%

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

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

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

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

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

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

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

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

    if 1.0000000000000001e299 < (*.f64 z z)

    1. Initial program 79.4%

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

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

        \[\leadsto x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot \left(z \cdot z - t\right) \]
      3. swap-sqr23.0%

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

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot \left(z \cdot z - t\right) \]
      5. metadata-eval23.0%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}} \cdot \left(z \cdot z - t\right) \]
      6. swap-sqr23.0%

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

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot \left(z \cdot z - t\right) \]
      8. add-sqr-sqrt7.3%

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

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

        \[\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. Applied egg-rr1.4%

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

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

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

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

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

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

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      3. times-frac79.4%

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

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

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. sqrt-prod41.9%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. add-sqr-sqrt46.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      9. sqrt-div46.3%

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      11. unpow246.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \]
      12. sqrt-prod51.3%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \]
      13. add-sqr-sqrt95.7%

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

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

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

Alternative 2: 94.7% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 94.6%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\right)} \]
      2. distribute-lft-neg-in95.5%

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

        \[\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-in95.5%

        \[\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-eval95.5%

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

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

    if 5.09999999999999999e157 < z

    1. Initial program 81.6%

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

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

        \[\leadsto x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot \left(z \cdot z - t\right) \]
      3. swap-sqr28.0%

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

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot \left(z \cdot z - t\right) \]
      5. metadata-eval28.0%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}} \cdot \left(z \cdot z - t\right) \]
      6. swap-sqr28.0%

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

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot \left(z \cdot z - t\right) \]
      8. add-sqr-sqrt5.6%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - \frac{\color{blue}{y \cdot 4}}{\frac{1}{{z}^{2}}} \]
      2. add-sqr-sqrt81.6%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      3. times-frac81.6%

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

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

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. sqrt-prod81.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. add-sqr-sqrt81.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      9. sqrt-div81.6%

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      11. unpow281.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \]
      12. sqrt-prod99.8%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \]
      13. add-sqr-sqrt100.0%

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

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

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

Alternative 3: 90.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 1.21999999999999992e203

    1. Initial program 96.5%

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

    if 1.21999999999999992e203 < (*.f64 x x)

    1. Initial program 85.6%

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

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

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

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

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

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

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

Alternative 4: 93.1% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 94.6%

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

    if 1.00000000000000002e151 < z

    1. Initial program 81.6%

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

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

        \[\leadsto x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot \left(z \cdot z - t\right) \]
      3. swap-sqr28.0%

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

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot \left(z \cdot z - t\right) \]
      5. metadata-eval28.0%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}} \cdot \left(z \cdot z - t\right) \]
      6. swap-sqr28.0%

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

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot \left(z \cdot z - t\right) \]
      8. add-sqr-sqrt5.6%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - \frac{\color{blue}{y \cdot 4}}{\frac{1}{{z}^{2}}} \]
      2. add-sqr-sqrt81.6%

        \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\sqrt{\frac{1}{{z}^{2}}} \cdot \sqrt{\frac{1}{{z}^{2}}}}} \]
      3. times-frac81.6%

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

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

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      7. sqrt-prod81.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      8. add-sqr-sqrt81.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{\color{blue}{z}}} \cdot \frac{4}{\sqrt{\frac{1}{{z}^{2}}}} \]
      9. sqrt-div81.6%

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

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{\color{blue}{1}}{\sqrt{{z}^{2}}}} \]
      11. unpow281.6%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\sqrt{\color{blue}{z \cdot z}}}} \]
      12. sqrt-prod99.8%

        \[\leadsto x \cdot x - \frac{y}{\frac{1}{z}} \cdot \frac{4}{\frac{1}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}} \]
      13. add-sqr-sqrt100.0%

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

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

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

Alternative 5: 90.5% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot x + \frac{-1}{\frac{\frac{-1}{t}}{y \cdot 4}}\\


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

    1. Initial program 94.1%

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

    if 3.50000000000000023e101 < x

    1. Initial program 85.2%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. add-sqr-sqrt40.0%

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

        \[\leadsto x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot \left(y \cdot 4\right)}} \cdot \left(z \cdot z - t\right) \]
      3. swap-sqr57.8%

        \[\leadsto x \cdot x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(4 \cdot 4\right)}} \cdot \left(z \cdot z - t\right) \]
      4. metadata-eval57.8%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{16}} \cdot \left(z \cdot z - t\right) \]
      5. metadata-eval57.8%

        \[\leadsto x \cdot x - \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}} \cdot \left(z \cdot z - t\right) \]
      6. swap-sqr57.8%

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

        \[\leadsto x \cdot x - \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)} \cdot \left(z \cdot z - t\right) \]
      8. add-sqr-sqrt74.9%

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

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

        \[\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. Applied egg-rr50.3%

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

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

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

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

      \[\leadsto x \cdot x - \frac{4 \cdot y}{\color{blue}{\frac{-1}{t}}} \]
    7. Step-by-step derivation
      1. clear-num92.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{1}{\frac{\frac{-1}{t}}{4 \cdot y}}} \]
      2. inv-pow92.5%

        \[\leadsto x \cdot x - \color{blue}{{\left(\frac{\frac{-1}{t}}{4 \cdot y}\right)}^{-1}} \]
    8. Applied egg-rr92.5%

      \[\leadsto x \cdot x - \color{blue}{{\left(\frac{\frac{-1}{t}}{4 \cdot y}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-192.5%

        \[\leadsto x \cdot x - \color{blue}{\frac{1}{\frac{\frac{-1}{t}}{4 \cdot y}}} \]
    10. Simplified92.5%

      \[\leadsto x \cdot x - \color{blue}{\frac{1}{\frac{\frac{-1}{t}}{4 \cdot y}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.9%

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

Alternative 6: 66.5% accurate, 1.4× speedup?

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

\\
x \cdot x - y \cdot \left(t \cdot -4\right)
\end{array}
Derivation
  1. Initial program 92.7%

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

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

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

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

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

    \[\leadsto x \cdot x - \color{blue}{y \cdot \left(t \cdot -4\right)} \]
  5. Final simplification64.7%

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

Alternative 7: 31.4% accurate, 2.6× speedup?

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

\\
y \cdot \left(4 \cdot t\right)
\end{array}
Derivation
  1. Initial program 92.7%

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

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

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

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

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

    \[\leadsto y \cdot \left(4 \cdot t\right) \]

Developer target: 90.7% 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 2023318 
(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))))