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

Percentage Accurate: 90.5% → 93.0%
Time: 11.0s
Alternatives: 10
Speedup: 0.4×

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 10 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.5% 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: 93.0% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 1.45 \cdot 10^{+246}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot x\_m - t \cdot \left(y \cdot 4\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= x_m 1.45e+246)
   (fma x_m x_m (* (- (* z z) t) (* y -4.0)))
   (- (* x_m x_m) (* t (* y 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 1.45e+246) {
		tmp = fma(x_m, x_m, (((z * z) - t) * (y * -4.0)));
	} else {
		tmp = (x_m * x_m) - (t * (y * 4.0));
	}
	return tmp;
}
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (x_m <= 1.45e+246)
		tmp = fma(x_m, x_m, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)));
	else
		tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(y * 4.0)));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 1.45e+246], N[(x$95$m * x$95$m + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

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


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

    1. Initial program 88.9%

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

        \[\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-in92.6%

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

        \[\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-in92.6%

        \[\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-eval92.6%

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

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

    if 1.45000000000000007e246 < x

    1. Initial program 75.0%

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

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

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

        \[\leadsto x \cdot x - \left(\left(y \cdot 4\right) \cdot t\right) \cdot \color{blue}{\left(\frac{{z}^{2}}{t} + \left(-1\right)\right)} \]
      3. distribute-rgt-in75.0%

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \color{blue}{\left(t \cdot \left(y \cdot 4\right)\right)}\right) \]
      6. add-sqr-sqrt50.0%

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

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

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

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

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right)\right) \]
      13. add-sqr-sqrt83.3%

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(y \cdot -4\right)}\right)\right) \]
      14. associate-*l*83.3%

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \color{blue}{\left(-t\right)} \cdot \left(y \cdot -4\right)\right) \]
      17. add-sqr-sqrt33.3%

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-t\right) \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right) \]
    5. Applied egg-rr83.3%

      \[\leadsto x \cdot x - \color{blue}{\left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + t \cdot \left(y \cdot 4\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-lft1-in91.7%

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

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

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

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

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

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

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

Alternative 2: 92.0% accurate, 0.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \mathsf{fma}\left(z, \frac{z}{t}, -1\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 4.0000000000000004e252

    1. Initial program 97.1%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if 4.0000000000000004e252 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))

    1. Initial program 58.5%

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

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

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

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

        \[\leadsto -4 \cdot \left(t \cdot \left(y \cdot \left(\color{blue}{z \cdot \frac{z}{t}} - 1\right)\right)\right) \]
      3. fma-neg76.9%

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

        \[\leadsto -4 \cdot \left(t \cdot \left(y \cdot \mathsf{fma}\left(z, \frac{z}{t}, \color{blue}{-1}\right)\right)\right) \]
    6. Simplified76.9%

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

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

Alternative 3: 92.5% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \cdot x\_m \leq 5 \cdot 10^{+262}:\\ \;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, y \cdot \left(t \cdot 4\right)\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= (* x_m x_m) 5e+262)
   (+ (* x_m x_m) (* (* y 4.0) (- t (* z z))))
   (fma x_m x_m (* y (* t 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * x_m) <= 5e+262) {
		tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = fma(x_m, x_m, (y * (t * 4.0)));
	}
	return tmp;
}
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (Float64(x_m * x_m) <= 5e+262)
		tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z))));
	else
		tmp = fma(x_m, x_m, Float64(y * Float64(t * 4.0)));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 5e+262], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * x$95$m + N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, y \cdot \left(t \cdot 4\right)\right)\\


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

    1. Initial program 93.2%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if 5.00000000000000008e262 < (*.f64 x x)

    1. Initial program 72.3%

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(-4 \cdot t\right) \cdot y} \]
    6. Step-by-step derivation
      1. fma-neg85.2%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, y \cdot \left(\color{blue}{4} \cdot t\right)\right) \]
    7. Applied egg-rr85.2%

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

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

Alternative 4: 92.4% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \cdot x\_m \leq 5 \cdot 10^{+265}:\\ \;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;{x\_m}^{2}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= (* x_m x_m) 5e+265)
   (+ (* x_m x_m) (* (* y 4.0) (- t (* z z))))
   (pow x_m 2.0)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * x_m) <= 5e+265) {
		tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = pow(x_m, 2.0);
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x_m * x_m) <= 5d+265) then
        tmp = (x_m * x_m) + ((y * 4.0d0) * (t - (z * z)))
    else
        tmp = x_m ** 2.0d0
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if ((x_m * x_m) <= 5e+265) {
		tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	} else {
		tmp = Math.pow(x_m, 2.0);
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if (x_m * x_m) <= 5e+265:
		tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)))
	else:
		tmp = math.pow(x_m, 2.0)
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (Float64(x_m * x_m) <= 5e+265)
		tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z))));
	else
		tmp = x_m ^ 2.0;
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if ((x_m * x_m) <= 5e+265)
		tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	else
		tmp = x_m ^ 2.0;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 5e+265], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x$95$m, 2.0], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

\mathbf{else}:\\
\;\;\;\;{x\_m}^{2}\\


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

    1. Initial program 93.3%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if 5.0000000000000002e265 < (*.f64 x x)

    1. Initial program 71.8%

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

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

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

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

Alternative 5: 91.4% accurate, 0.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_1 := x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t \cdot y\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (let* ((t_1 (+ (* x_m x_m) (* (* y 4.0) (- t (* z z))))))
   (if (<= t_1 INFINITY) t_1 (* -4.0 (* t y)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = -4.0 * (t * y);
	}
	return tmp;
}
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = -4.0 * (t * y);
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = -4.0 * (t * y)
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	t_1 = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(-4.0 * Float64(t * y));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = -4.0 * (t * y);
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_1 := x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0

    1. Initial program 94.1%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing

    if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)))

    1. Initial program 0.0%

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

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

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

        \[\leadsto x \cdot x - \left(\left(y \cdot 4\right) \cdot t\right) \cdot \color{blue}{\left(\frac{{z}^{2}}{t} + \left(-1\right)\right)} \]
      3. distribute-rgt-in0.0%

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \color{blue}{\left(t \cdot \left(y \cdot 4\right)\right)}\right) \]
      6. add-sqr-sqrt0.0%

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

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

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}\right)\right) \]
      11. swap-sqr12.5%

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right)\right) \]
      13. add-sqr-sqrt12.5%

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(y \cdot -4\right)}\right)\right) \]
      14. associate-*l*12.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 66.3% accurate, 0.9× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \leq 4 \cdot 10^{+200}:\\ \;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot x\_m - t \cdot \left(y \cdot 4\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= x_m 4e+200)
   (- (* x_m x_m) (* y (* t -4.0)))
   (- (* x_m x_m) (* t (* y 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 4e+200) {
		tmp = (x_m * x_m) - (y * (t * -4.0));
	} else {
		tmp = (x_m * x_m) - (t * (y * 4.0));
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x_m <= 4d+200) then
        tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
    else
        tmp = (x_m * x_m) - (t * (y * 4.0d0))
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (x_m <= 4e+200) {
		tmp = (x_m * x_m) - (y * (t * -4.0));
	} else {
		tmp = (x_m * x_m) - (t * (y * 4.0));
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if x_m <= 4e+200:
		tmp = (x_m * x_m) - (y * (t * -4.0))
	else:
		tmp = (x_m * x_m) - (t * (y * 4.0))
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (x_m <= 4e+200)
		tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0)));
	else
		tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(y * 4.0)));
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (x_m <= 4e+200)
		tmp = (x_m * x_m) - (y * (t * -4.0));
	else
		tmp = (x_m * x_m) - (t * (y * 4.0));
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4e+200], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

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


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

    1. Initial program 89.1%

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

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

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

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

    if 3.9999999999999999e200 < x

    1. Initial program 75.0%

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

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

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

        \[\leadsto x \cdot x - \left(\left(y \cdot 4\right) \cdot t\right) \cdot \color{blue}{\left(\frac{{z}^{2}}{t} + \left(-1\right)\right)} \]
      3. distribute-rgt-in75.0%

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \color{blue}{\left(t \cdot \left(y \cdot 4\right)\right)}\right) \]
      6. add-sqr-sqrt43.8%

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

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

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

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

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right)\right) \]
      13. add-sqr-sqrt81.3%

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(y \cdot -4\right)}\right)\right) \]
      14. associate-*l*81.3%

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

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-t\right) \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right) \]
    5. Applied egg-rr81.3%

      \[\leadsto x \cdot x - \color{blue}{\left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + t \cdot \left(y \cdot 4\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-lft1-in87.5%

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

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

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

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

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

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

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

Alternative 7: 31.1% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 91.4%

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

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

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

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

    if 2.3e94 < z

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(\sqrt{y \cdot -4} \cdot \sqrt{y \cdot -4}\right)}\right)\right) \]
      13. add-sqr-sqrt50.5%

        \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(y \cdot -4\right)}\right)\right) \]
      14. associate-*l*50.5%

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + t \cdot \left(y \cdot 4\right)\right)} \]
    6. Step-by-step derivation
      1. distribute-lft1-in55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 66.6% accurate, 1.4× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right) \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t) :precision binary64 (- (* x_m x_m) (* y (* t -4.0))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return (x_m * x_m) - (y * (t * -4.0));
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x_m * x_m) - (y * (t * (-4.0d0)))
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return (x_m * x_m) - (y * (t * -4.0));
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return (x_m * x_m) - (y * (t * -4.0))
x_m = abs(x)
function code(x_m, y, z, t)
	return Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0)))
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = (x_m * x_m) - (y * (t * -4.0));
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

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

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

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

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

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

    \[\leadsto x \cdot x - y \cdot \left(t \cdot -4\right) \]
  7. Add Preprocessing

Alternative 9: 5.8% accurate, 2.6× speedup?

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

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

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

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

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

      \[\leadsto x \cdot x - \left(\left(y \cdot 4\right) \cdot t\right) \cdot \color{blue}{\left(\frac{{z}^{2}}{t} + \left(-1\right)\right)} \]
    3. distribute-rgt-in75.7%

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

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

      \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \color{blue}{\left(t \cdot \left(y \cdot 4\right)\right)}\right) \]
    6. add-sqr-sqrt36.8%

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

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

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

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

      \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}\right)\right) \]
    11. swap-sqr52.5%

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

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

      \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \left(-1\right) \cdot \left(t \cdot \color{blue}{\left(y \cdot -4\right)}\right)\right) \]
    14. associate-*l*52.8%

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

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

      \[\leadsto x \cdot x - \left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + \color{blue}{\left(-t\right)} \cdot \left(y \cdot -4\right)\right) \]
    17. add-sqr-sqrt27.7%

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

    \[\leadsto x \cdot x - \color{blue}{\left(\frac{{z}^{2}}{t} \cdot \left(t \cdot \left(y \cdot 4\right)\right) + t \cdot \left(y \cdot 4\right)\right)} \]
  6. Step-by-step derivation
    1. distribute-lft1-in55.2%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -4 \cdot \color{blue}{\left(t \cdot y\right)} \]
  12. Add Preprocessing

Alternative 10: 3.1% accurate, 13.0× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ 0 \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t) :precision binary64 0.0)
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return 0.0;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 0.0d0
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return 0.0;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return 0.0
x_m = abs(x)
function code(x_m, y, z, t)
	return 0.0
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = 0.0;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := 0.0
\begin{array}{l}
x_m = \left|x\right|

\\
0
\end{array}
Derivation
  1. Initial program 88.2%

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

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

    \[\leadsto \color{blue}{0} \]
  5. Add Preprocessing

Developer target: 90.5% 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 2024086 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :alt
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

  (- (* x x) (* (* y 4.0) (- (* z z) t))))