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

Percentage Accurate: 90.7% → 95.4%
Time: 10.0s
Alternatives: 9
Speedup: 0.6×

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: 95.4% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 95.3%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(y \cdot 4\right) \cdot \left(z \cdot z + \color{blue}{\left(\mathsf{neg}\left(t\right)\right)}\right)\right)\right) \]
      2. distribute-rgt-inN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(z \cdot z\right) \cdot \left(y \cdot 4\right) + \color{blue}{\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot 4\right)}\right)\right) \]
      3. fma-defineN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\mathsf{fma}\left(z \cdot z, \color{blue}{y \cdot 4}, \left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot 4\right)\right)\right)\right) \]
      4. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\left(z \cdot z\right), \color{blue}{\left(y \cdot 4\right)}, \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot 4\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \left(\color{blue}{y} \cdot 4\right), \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot 4\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, \color{blue}{4}\right), \left(\left(\mathsf{neg}\left(t\right)\right) \cdot \left(y \cdot 4\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \left(\left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \left(y \cdot \left(4 \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \left(y \cdot \left(\left(\mathsf{neg}\left(t\right)\right) \cdot 4\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(\left(\mathsf{neg}\left(t\right)\right) \cdot 4\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(4 \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)\right)\right) \]
      12. neg-mul-1N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(4 \cdot \left(-1 \cdot t\right)\right)\right)\right)\right) \]
      13. associate-*r*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(\left(4 \cdot -1\right) \cdot t\right)\right)\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(-4 \cdot t\right)\right)\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \left(\left(\mathsf{neg}\left(4\right)\right) \cdot t\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(\left(\mathsf{neg}\left(4\right)\right), t\right)\right)\right)\right) \]
      17. metadata-eval95.3%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{fma.f64}\left(\mathsf{*.f64}\left(z, z\right), \mathsf{*.f64}\left(y, 4\right), \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(-4, t\right)\right)\right)\right) \]
    4. Applied egg-rr95.3%

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

    if 5.00000000000000036e190 < (*.f64 z z)

    1. Initial program 82.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(y \cdot 4\right) \cdot \frac{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}{\color{blue}{z \cdot z + t}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(y \cdot 4\right) \cdot \frac{1}{\color{blue}{\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}}}\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{y \cdot 4}{\color{blue}{\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\left(y \cdot 4\right), \color{blue}{\left(\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}\right)}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\color{blue}{z \cdot z + t}}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}\right)\right)\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1}{\color{blue}{\frac{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}{z \cdot z + t}}}\right)\right)\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1}{z \cdot z - \color{blue}{t}}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(z \cdot z\right), \color{blue}{t}\right)\right)\right)\right) \]
      10. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right)\right)\right)\right) \]
    4. Applied egg-rr82.9%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{z \cdot z - t}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \color{blue}{\left(\frac{1 + \frac{t}{{z}^{2}}}{{z}^{2}}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1 + \frac{t}{{z}^{2}}}{z \cdot \color{blue}{z}}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \frac{t}{{z}^{2}}}{z}}{\color{blue}{z}}\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{t}{{z}^{2}}\right)\right)\right)\right)}{z}}{z}\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \left(\mathsf{neg}\left(-1 \cdot \frac{t}{{z}^{2}}\right)\right)}{z}}{z}\right)\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 - -1 \cdot \frac{t}{{z}^{2}}}{z}}{z}\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\left(\frac{1 - -1 \cdot \frac{t}{{z}^{2}}}{z}\right), \color{blue}{z}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - -1 \cdot \frac{t}{{z}^{2}}\right), z\right), z\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(-1 \cdot \frac{t}{{z}^{2}}\right)\right)\right), z\right), z\right)\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{t}{{z}^{2}}\right)\right)\right)\right)\right), z\right), z\right)\right)\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \frac{t}{{z}^{2}}\right), z\right), z\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{t}{{z}^{2}}\right)\right), z\right), z\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left({z}^{2}\right)\right)\right), z\right), z\right)\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left(z \cdot z\right)\right)\right), z\right), z\right)\right)\right) \]
      14. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \mathsf{*.f64}\left(z, z\right)\right)\right), z\right), z\right)\right)\right) \]
    7. Simplified82.9%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{\frac{1 + \frac{t}{z \cdot z}}{z}}{z}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{y \cdot 4}{\frac{1 + \frac{t}{z \cdot z}}{z}} \cdot \color{blue}{z}\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{\left(y \cdot 4\right) \cdot z}{\color{blue}{\frac{1 + \frac{t}{z \cdot z}}{z}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\left(\left(y \cdot 4\right) \cdot z\right), \color{blue}{\left(\frac{1 + \frac{t}{z \cdot z}}{z}\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(y \cdot 4\right), z\right), \left(\frac{\color{blue}{1 + \frac{t}{z \cdot z}}}{z}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \left(\frac{\color{blue}{1} + \frac{t}{z \cdot z}}{z}\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\left(1 + \frac{t}{z \cdot z}\right), \color{blue}{z}\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{t}{z \cdot z}\right)\right), z\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left(z \cdot z\right)\right)\right), z\right)\right)\right) \]
      9. *-lowering-*.f6496.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \mathsf{*.f64}\left(z, z\right)\right)\right), z\right)\right)\right) \]
    9. Applied egg-rr96.4%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \color{blue}{\left(\frac{1}{z}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. /-lowering-/.f6496.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(1, \color{blue}{z}\right)\right)\right) \]
    12. Simplified96.4%

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

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

Alternative 2: 44.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \left(4 \cdot t\right)\\
\mathbf{if}\;x \leq 7.8 \cdot 10^{-221}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;x \leq 3.5 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 7.7999999999999997e-221 or 5.49999999999999975e-50 < x < 3.5e21

    1. Initial program 93.1%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(4 \cdot t\right)}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(t \cdot \color{blue}{4}\right)\right) \]
      5. *-lowering-*.f6436.4%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(t, \color{blue}{4}\right)\right) \]
    5. Simplified36.4%

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

    if 7.7999999999999997e-221 < x < 5.49999999999999975e-50

    1. Initial program 91.7%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(y \cdot {z}^{2}\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \color{blue}{\left({z}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \left(z \cdot \color{blue}{z}\right)\right)\right) \]
      4. *-lowering-*.f6453.4%

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(z, \color{blue}{z}\right)\right)\right) \]
    5. Simplified53.4%

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

    if 3.5e21 < x

    1. Initial program 86.8%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto x \cdot \color{blue}{x} \]
      2. *-lowering-*.f6472.5%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
    5. Simplified72.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 7.8 \cdot 10^{-221}:\\ \;\;\;\;y \cdot \left(4 \cdot t\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-50}:\\ \;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+21}:\\ \;\;\;\;y \cdot \left(4 \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.5% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 95.3%

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

    if 5.00000000000000036e190 < (*.f64 z z)

    1. Initial program 82.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(y \cdot 4\right) \cdot \frac{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}{\color{blue}{z \cdot z + t}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\left(y \cdot 4\right) \cdot \frac{1}{\color{blue}{\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}}}\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{y \cdot 4}{\color{blue}{\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\left(y \cdot 4\right), \color{blue}{\left(\frac{z \cdot z + t}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}\right)}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\color{blue}{z \cdot z + t}}{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}\right)\right)\right) \]
      6. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1}{\color{blue}{\frac{\left(z \cdot z\right) \cdot \left(z \cdot z\right) - t \cdot t}{z \cdot z + t}}}\right)\right)\right) \]
      7. flip--N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1}{z \cdot z - \color{blue}{t}}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\left(z \cdot z\right), \color{blue}{t}\right)\right)\right)\right) \]
      10. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(1, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right)\right)\right)\right) \]
    4. Applied egg-rr82.9%

      \[\leadsto x \cdot x - \color{blue}{\frac{y \cdot 4}{\frac{1}{z \cdot z - t}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \color{blue}{\left(\frac{1 + \frac{t}{{z}^{2}}}{{z}^{2}}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{1 + \frac{t}{{z}^{2}}}{z \cdot \color{blue}{z}}\right)\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \frac{t}{{z}^{2}}}{z}}{\color{blue}{z}}\right)\right)\right) \]
      3. remove-double-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{t}{{z}^{2}}\right)\right)\right)\right)}{z}}{z}\right)\right)\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 + \left(\mathsf{neg}\left(-1 \cdot \frac{t}{{z}^{2}}\right)\right)}{z}}{z}\right)\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \left(\frac{\frac{1 - -1 \cdot \frac{t}{{z}^{2}}}{z}}{z}\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\left(\frac{1 - -1 \cdot \frac{t}{{z}^{2}}}{z}\right), \color{blue}{z}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - -1 \cdot \frac{t}{{z}^{2}}\right), z\right), z\right)\right)\right) \]
      8. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(-1 \cdot \frac{t}{{z}^{2}}\right)\right)\right), z\right), z\right)\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{t}{{z}^{2}}\right)\right)\right)\right)\right), z\right), z\right)\right)\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + \frac{t}{{z}^{2}}\right), z\right), z\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{t}{{z}^{2}}\right)\right), z\right), z\right)\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left({z}^{2}\right)\right)\right), z\right), z\right)\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left(z \cdot z\right)\right)\right), z\right), z\right)\right)\right) \]
      14. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, 4\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \mathsf{*.f64}\left(z, z\right)\right)\right), z\right), z\right)\right)\right) \]
    7. Simplified82.9%

      \[\leadsto x \cdot x - \frac{y \cdot 4}{\color{blue}{\frac{\frac{1 + \frac{t}{z \cdot z}}{z}}{z}}} \]
    8. Step-by-step derivation
      1. associate-/r/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{y \cdot 4}{\frac{1 + \frac{t}{z \cdot z}}{z}} \cdot \color{blue}{z}\right)\right) \]
      2. associate-*l/N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{\left(y \cdot 4\right) \cdot z}{\color{blue}{\frac{1 + \frac{t}{z \cdot z}}{z}}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\left(\left(y \cdot 4\right) \cdot z\right), \color{blue}{\left(\frac{1 + \frac{t}{z \cdot z}}{z}\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(y \cdot 4\right), z\right), \left(\frac{\color{blue}{1 + \frac{t}{z \cdot z}}}{z}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \left(\frac{\color{blue}{1} + \frac{t}{z \cdot z}}{z}\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\left(1 + \frac{t}{z \cdot z}\right), \color{blue}{z}\right)\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{t}{z \cdot z}\right)\right), z\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \left(z \cdot z\right)\right)\right), z\right)\right)\right) \]
      9. *-lowering-*.f6496.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(t, \mathsf{*.f64}\left(z, z\right)\right)\right), z\right)\right)\right) \]
    9. Applied egg-rr96.4%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \color{blue}{\left(\frac{1}{z}\right)}\right)\right) \]
    11. Step-by-step derivation
      1. /-lowering-/.f6496.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, 4\right), z\right), \mathsf{/.f64}\left(1, \color{blue}{z}\right)\right)\right) \]
    12. Simplified96.4%

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

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

Alternative 4: 93.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 95.4%

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

    if 2.5500000000000001e296 < (*.f64 x x)

    1. Initial program 80.8%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto x \cdot \color{blue}{x} \]
      2. *-lowering-*.f6491.8%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
    5. Simplified91.8%

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

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

Alternative 5: 46.0% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 8.19999999999999962e-221

    1. Initial program 93.2%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(4 \cdot t\right)}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(t \cdot \color{blue}{4}\right)\right) \]
      5. *-lowering-*.f6434.3%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(t, \color{blue}{4}\right)\right) \]
    5. Simplified34.3%

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

    if 8.19999999999999962e-221 < x < 2.60000000000000011e56

    1. Initial program 93.1%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(y \cdot {z}^{2}\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \color{blue}{\left({z}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \left(z \cdot \color{blue}{z}\right)\right)\right) \]
      4. *-lowering-*.f6444.4%

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(z, \color{blue}{z}\right)\right)\right) \]
    5. Simplified44.4%

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right) \cdot \left(z \cdot z\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(4 \cdot y\right)\right) \cdot \left(\color{blue}{z} \cdot z\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot \color{blue}{z} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right), \color{blue}{z}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right), z\right), z\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right), z\right), z\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(y \cdot -4\right), z\right), z\right) \]
      10. *-lowering-*.f6451.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, -4\right), z\right), z\right) \]
    7. Applied egg-rr51.2%

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

    if 2.60000000000000011e56 < x

    1. Initial program 84.5%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto x \cdot \color{blue}{x} \]
      2. *-lowering-*.f6479.4%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
    5. Simplified79.4%

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

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

Alternative 6: 80.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 96.0%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(y \cdot \left({z}^{2} - t\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \color{blue}{\left({z}^{2} - t\right)}\right)\right) \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left({z}^{2}\right), \color{blue}{t}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\left(z \cdot z\right), t\right)\right)\right) \]
      5. *-lowering-*.f6487.6%

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(z, z\right), t\right)\right)\right) \]
    5. Simplified87.6%

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

    if 2.25e113 < (*.f64 x x)

    1. Initial program 85.4%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto x \cdot \color{blue}{x} \]
      2. *-lowering-*.f6480.6%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
    5. Simplified80.6%

      \[\leadsto \color{blue}{x \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 75.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 92.4%

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

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \color{blue}{\left(-4 \cdot \left(t \cdot y\right)\right)}\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(-4, \color{blue}{\left(t \cdot y\right)}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(-4, \left(y \cdot \color{blue}{t}\right)\right)\right) \]
      3. *-lowering-*.f6474.5%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \color{blue}{t}\right)\right)\right) \]
    5. Simplified74.5%

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

    if 8.6e94 < z

    1. Initial program 84.3%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \color{blue}{\left(y \cdot {z}^{2}\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \color{blue}{\left({z}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \left(z \cdot \color{blue}{z}\right)\right)\right) \]
      4. *-lowering-*.f6484.4%

        \[\leadsto \mathsf{*.f64}\left(-4, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(z, \color{blue}{z}\right)\right)\right) \]
    5. Simplified84.4%

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot \left(z \cdot z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      2. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(4\right)\right) \cdot y\right) \cdot \left(z \cdot z\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(4 \cdot y\right)\right) \cdot \left(\color{blue}{z} \cdot z\right) \]
      4. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z\right) \]
      5. associate-*r*N/A

        \[\leadsto \left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right) \cdot \color{blue}{z} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot z\right), \color{blue}{z}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right), z\right), z\right) \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(y \cdot \left(\mathsf{neg}\left(4\right)\right)\right), z\right), z\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(y \cdot -4\right), z\right), z\right) \]
      10. *-lowering-*.f6491.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(y, -4\right), z\right), z\right) \]
    7. Applied egg-rr91.9%

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

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

Alternative 8: 44.9% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 92.8%

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(4 \cdot t\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(4 \cdot t\right)}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(t \cdot \color{blue}{4}\right)\right) \]
      5. *-lowering-*.f6436.6%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(t, \color{blue}{4}\right)\right) \]
    5. Simplified36.6%

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

    if 1.0499999999999999e22 < x

    1. Initial program 86.8%

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

      \[\leadsto \color{blue}{{x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto x \cdot \color{blue}{x} \]
      2. *-lowering-*.f6472.5%

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
    5. Simplified72.5%

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

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

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

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

    \[\leadsto \color{blue}{{x}^{2}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto x \cdot \color{blue}{x} \]
    2. *-lowering-*.f6443.0%

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{x}\right) \]
  5. Simplified43.0%

    \[\leadsto \color{blue}{x \cdot x} \]
  6. Add Preprocessing

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

  :alt
  (! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))

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