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

Percentage Accurate: 90.7% → 97.0%
Time: 6.4s
Alternatives: 9
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 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 90.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.0% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 99.0%

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

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

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

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

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

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

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

    if 2.00000000000000011e301 < (*.f64 z z)

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(\left(4 \cdot y\right) \cdot z\right) \cdot z} \]
    5. Step-by-step derivation
      1. sub-neg98.0%

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-\left(4 \cdot y\right) \cdot z\right) \cdot \sqrt{z}\right) \cdot \sqrt{z}} + x \cdot x \]
      6. associate-*l*44.4%

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

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

        \[\leadsto \left(\left(\color{blue}{-4} \cdot \left(y \cdot z\right)\right) \cdot \sqrt{z}\right) \cdot \sqrt{z} + x \cdot x \]
      9. associate-*l*44.4%

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

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

        \[\leadsto \left(\color{blue}{\left(z \cdot \left(y \cdot -4\right)\right)} \cdot \sqrt{z}\right) \cdot \sqrt{z} + x \cdot x \]
      12. associate-*r*44.4%

        \[\leadsto \color{blue}{\left(z \cdot \left(y \cdot -4\right)\right) \cdot \left(\sqrt{z} \cdot \sqrt{z}\right)} + x \cdot x \]
      13. add-sqr-sqrt98.0%

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

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

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

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

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

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

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

Alternative 2: 96.4% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 99.0%

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

    if 2.00000000000000011e301 < (*.f64 z z)

    1. Initial program 75.3%

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

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

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

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

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

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

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

      \[\leadsto x \cdot x - \color{blue}{\left(\left(4 \cdot y\right) \cdot z\right) \cdot z} \]
    5. Step-by-step derivation
      1. sub-neg98.0%

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(-\left(4 \cdot y\right) \cdot z\right) \cdot \sqrt{z}\right) \cdot \sqrt{z}} + x \cdot x \]
      6. associate-*l*44.4%

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

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

        \[\leadsto \left(\left(\color{blue}{-4} \cdot \left(y \cdot z\right)\right) \cdot \sqrt{z}\right) \cdot \sqrt{z} + x \cdot x \]
      9. associate-*l*44.4%

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

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

        \[\leadsto \left(\color{blue}{\left(z \cdot \left(y \cdot -4\right)\right)} \cdot \sqrt{z}\right) \cdot \sqrt{z} + x \cdot x \]
      12. associate-*r*44.4%

        \[\leadsto \color{blue}{\left(z \cdot \left(y \cdot -4\right)\right) \cdot \left(\sqrt{z} \cdot \sqrt{z}\right)} + x \cdot x \]
      13. add-sqr-sqrt98.0%

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

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

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

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

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

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

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

Alternative 3: 84.8% accurate, 0.6× speedup?

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

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

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

\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+231}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 z z) < 4.99999999999999989e122 or 4.9999999999999996e158 < (*.f64 z z) < 4.0000000000000002e231

    1. Initial program 98.8%

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

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

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

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

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

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

    if 4.99999999999999989e122 < (*.f64 z z) < 4.9999999999999996e158

    1. Initial program 99.8%

      \[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(\left({z}^{2} - t\right) \cdot y\right)} \]
    3. Step-by-step derivation
      1. *-commutative76.6%

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

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

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

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

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

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

    if 4.0000000000000002e231 < (*.f64 z z)

    1. Initial program 81.5%

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

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

        \[\leadsto \color{blue}{\left(-4\right)} \cdot \left(y \cdot {z}^{2}\right) \]
      2. distribute-lft-neg-in76.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \left(-z \cdot \left(y \cdot 4\right)\right)} \]
      9. distribute-rgt-neg-in87.6%

        \[\leadsto z \cdot \color{blue}{\left(z \cdot \left(-y \cdot 4\right)\right)} \]
      10. distribute-rgt-neg-in87.6%

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

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

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

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

Alternative 4: 58.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 2.25 \cdot 10^{+92}:\\
\;\;\;\;x \cdot x\\

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

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


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

    1. Initial program 93.4%

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

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

    if 2.4000000000000001e-11 < (*.f64 x x) < 2.25e92 or 4.49999999999999985e157 < (*.f64 x x)

    1. Initial program 94.1%

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

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

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

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

    if 2.25e92 < (*.f64 x x) < 4.49999999999999985e157

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2.4 \cdot 10^{-11}:\\ \;\;\;\;4 \cdot \left(t \cdot y\right)\\ \mathbf{elif}\;x \cdot x \leq 2.25 \cdot 10^{+92}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;x \cdot x \leq 4.5 \cdot 10^{+157}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]

Alternative 5: 95.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 99.0%

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

    if 2.00000000000000011e301 < (*.f64 z z)

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

Alternative 6: 88.7% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 98.6%

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

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

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

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

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

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

    if 1e115 < (*.f64 z z)

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 80.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

    if 4.1999999999999998e158 < (*.f64 x x)

    1. Initial program 93.4%

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

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

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

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

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

Alternative 8: 58.6% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 93.4%

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

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

    if 3e-11 < (*.f64 x x)

    1. Initial program 94.6%

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

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

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

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

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

Alternative 9: 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 94.0%

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

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

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

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

    \[\leadsto x \cdot x \]

Developer target: 90.7% accurate, 1.0× speedup?

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

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

Reproduce

?
herbie shell --seed 2023214 
(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))))