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

Percentage Accurate: 90.8% → 97.3%
Time: 16.0s
Alternatives: 10
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 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.8% 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: 97.3% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y 4) < -1.00000000000000005e57 or 9.9999999999999999e-132 < (*.f64 y 4)

    1. Initial program 94.9%

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

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

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

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

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

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

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

    if -1.00000000000000005e57 < (*.f64 y 4) < 9.9999999999999999e-132

    1. Initial program 86.1%

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\mathsf{fma}\left(z \cdot z, y \cdot 4, \left(-t\right) \cdot \left(y \cdot 4\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef86.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 91.1% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y 4) (-.f64 (*.f64 z z) t)) < 2.0000000000000001e190

    1. Initial program 96.6%

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

    if 2.0000000000000001e190 < (*.f64 (*.f64 y 4) (-.f64 (*.f64 z z) t))

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

Alternative 3: 86.1% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 97.9%

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

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

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

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

    if 6.6e78 < (*.f64 z z) < 1.5499999999999999e300

    1. Initial program 99.8%

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

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

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

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

    if 1.5499999999999999e300 < (*.f64 z z)

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

Alternative 4: 58.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2.35 \cdot 10^{-63} \lor \neg \left(x \cdot x \leq 6.5 \cdot 10^{+31}\right) \land x \cdot x \leq 4.7 \cdot 10^{+60}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* x x) 2.35e-63)
         (and (not (<= (* x x) 6.5e+31)) (<= (* x x) 4.7e+60)))
   (* 4.0 (* y t))
   (* x x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) <= 2.35e-63) || (!((x * x) <= 6.5e+31) && ((x * x) <= 4.7e+60))) {
		tmp = 4.0 * (y * t);
	} else {
		tmp = x * x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (((x * x) <= 2.35d-63) .or. (.not. ((x * x) <= 6.5d+31)) .and. ((x * x) <= 4.7d+60)) then
        tmp = 4.0d0 * (y * t)
    else
        tmp = x * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((x * x) <= 2.35e-63) || (!((x * x) <= 6.5e+31) && ((x * x) <= 4.7e+60))) {
		tmp = 4.0 * (y * t);
	} else {
		tmp = x * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x * x) <= 2.35e-63) or (not ((x * x) <= 6.5e+31) and ((x * x) <= 4.7e+60)):
		tmp = 4.0 * (y * t)
	else:
		tmp = x * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x * x) <= 2.35e-63) || (!(Float64(x * x) <= 6.5e+31) && (Float64(x * x) <= 4.7e+60)))
		tmp = Float64(4.0 * Float64(y * t));
	else
		tmp = Float64(x * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x * x) <= 2.35e-63) || (~(((x * x) <= 6.5e+31)) && ((x * x) <= 4.7e+60)))
		tmp = 4.0 * (y * t);
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 2.35e-63], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 6.5e+31]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 4.7e+60]]], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.35 \cdot 10^{-63} \lor \neg \left(x \cdot x \leq 6.5 \cdot 10^{+31}\right) \land x \cdot x \leq 4.7 \cdot 10^{+60}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 2.35e-63 or 6.5000000000000004e31 < (*.f64 x x) < 4.6999999999999998e60

    1. Initial program 91.8%

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

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

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

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

    if 2.35e-63 < (*.f64 x x) < 6.5000000000000004e31 or 4.6999999999999998e60 < (*.f64 x x)

    1. Initial program 90.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2.35 \cdot 10^{-63} \lor \neg \left(x \cdot x \leq 6.5 \cdot 10^{+31}\right) \land x \cdot x \leq 4.7 \cdot 10^{+60}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 5: 58.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-63}:\\ \;\;\;\;y \cdot \left(4 \cdot t\right)\\ \mathbf{elif}\;x \cdot x \leq 8.2 \cdot 10^{+31} \lor \neg \left(x \cdot x \leq 4.5 \cdot 10^{+60}\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (* x x) 1.2e-63)
   (* y (* 4.0 t))
   (if (or (<= (* x x) 8.2e+31) (not (<= (* x x) 4.5e+60)))
     (* x x)
     (* 4.0 (* y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 1.2e-63) {
		tmp = y * (4.0 * t);
	} else if (((x * x) <= 8.2e+31) || !((x * x) <= 4.5e+60)) {
		tmp = x * x;
	} else {
		tmp = 4.0 * (y * t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((x * x) <= 1.2d-63) then
        tmp = y * (4.0d0 * t)
    else if (((x * x) <= 8.2d+31) .or. (.not. ((x * x) <= 4.5d+60))) then
        tmp = x * x
    else
        tmp = 4.0d0 * (y * t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x * x) <= 1.2e-63) {
		tmp = y * (4.0 * t);
	} else if (((x * x) <= 8.2e+31) || !((x * x) <= 4.5e+60)) {
		tmp = x * x;
	} else {
		tmp = 4.0 * (y * t);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x * x) <= 1.2e-63:
		tmp = y * (4.0 * t)
	elif ((x * x) <= 8.2e+31) or not ((x * x) <= 4.5e+60):
		tmp = x * x
	else:
		tmp = 4.0 * (y * t)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(x * x) <= 1.2e-63)
		tmp = Float64(y * Float64(4.0 * t));
	elseif ((Float64(x * x) <= 8.2e+31) || !(Float64(x * x) <= 4.5e+60))
		tmp = Float64(x * x);
	else
		tmp = Float64(4.0 * Float64(y * t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x * x) <= 1.2e-63)
		tmp = y * (4.0 * t);
	elseif (((x * x) <= 8.2e+31) || ~(((x * x) <= 4.5e+60)))
		tmp = x * x;
	else
		tmp = 4.0 * (y * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.2e-63], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * x), $MachinePrecision], 8.2e+31], N[Not[LessEqual[N[(x * x), $MachinePrecision], 4.5e+60]], $MachinePrecision]], N[(x * x), $MachinePrecision], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot x \leq 8.2 \cdot 10^{+31} \lor \neg \left(x \cdot x \leq 4.5 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot x\\

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


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

    1. Initial program 92.9%

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

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

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

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

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

    if 1.2e-63 < (*.f64 x x) < 8.2000000000000003e31 or 4.50000000000000013e60 < (*.f64 x x)

    1. Initial program 90.0%

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

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

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

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

    if 8.2000000000000003e31 < (*.f64 x x) < 4.50000000000000013e60

    1. Initial program 79.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-63}:\\ \;\;\;\;y \cdot \left(4 \cdot t\right)\\ \mathbf{elif}\;x \cdot x \leq 8.2 \cdot 10^{+31} \lor \neg \left(x \cdot x \leq 4.5 \cdot 10^{+60}\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 6: 93.5% accurate, 0.8× speedup?

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

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

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

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

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

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

    \[\leadsto x \cdot x - \color{blue}{\mathsf{fma}\left(z \cdot z, y \cdot 4, \left(-t\right) \cdot \left(y \cdot 4\right)\right)} \]
  4. Step-by-step derivation
    1. fma-udef89.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 80.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.2%

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

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

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

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

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

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

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

    if 3.80000000000000018e222 < (*.f64 x x)

    1. Initial program 86.2%

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

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

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

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

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

Alternative 8: 59.1% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4.8 \cdot 10^{+78}:\\
\;\;\;\;x \cdot x\\

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


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

    1. Initial program 97.9%

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

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

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

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

    if 4.7999999999999997e78 < (*.f64 z z)

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

Alternative 9: 74.9% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 92.3%

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

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

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

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

    if 3.19999999999999993e39 < z

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

Alternative 10: 41.4% accurate, 4.3× speedup?

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

\\
x \cdot x
\end{array}
Derivation
  1. Initial program 90.8%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 90.8% 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 2023277 
(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))))