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

Percentage Accurate: 91.1% → 95.1%
Time: 10.9s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 91.1% 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.1% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e297 < (*.f64 z z)

    1. Initial program 69.0%

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(\frac{y \cdot {z}^{2}}{t} \cdot 4 + \color{blue}{\left(-y \cdot 4\right)}\right) \]
      6. distribute-lft-neg-in69.0%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \color{blue}{\left(\frac{y \cdot {z}^{2}}{t} - y\right)}\right) \]
      9. associate-/l*69.0%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{z \cdot z}}{t} - y\right)\right) \]
      2. *-un-lft-identity69.0%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z \cdot z}{\color{blue}{1 \cdot t}} - y\right)\right) \]
      3. times-frac71.8%

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

      \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{1} \cdot \frac{z}{t}\right)} - y\right)\right) \]
    8. Step-by-step derivation
      1. clear-num71.8%

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\frac{z \cdot 1}{1 \cdot \frac{t}{z}}} - y\right)\right) \]
      3. metadata-eval71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z \cdot \color{blue}{\frac{1}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      4. div-inv71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{\frac{z}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      5. /-rgt-identity71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{z}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      6. metadata-eval71.8%

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\color{blue}{\frac{1 \cdot t}{1 \cdot z}}} - y\right)\right) \]
      8. *-un-lft-identity71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\frac{\color{blue}{t}}{1 \cdot z}} - y\right)\right) \]
      9. *-un-lft-identity71.8%

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(\color{blue}{\frac{\frac{y \cdot z}{t}}{\frac{1}{z}}} - y\right)\right) \]
    11. Applied egg-rr81.7%

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

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

Alternative 2: 93.6% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y #s(literal 4 binary64)) < 9.99999999999999915e-146

    1. Initial program 89.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 87.4%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \color{blue}{\left(\frac{y \cdot {z}^{2}}{t} - y\right)}\right) \]
      9. associate-/l*84.5%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{z \cdot z}}{t} - y\right)\right) \]
      2. *-un-lft-identity84.5%

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

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

      \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{1} \cdot \frac{z}{t}\right)} - y\right)\right) \]
    8. Step-by-step derivation
      1. clear-num85.7%

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{\frac{z}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      5. /-rgt-identity85.7%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\color{blue}{\frac{1 \cdot t}{1 \cdot z}}} - y\right)\right) \]
      8. *-un-lft-identity85.7%

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

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

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

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

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

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

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

    if 9.99999999999999915e-146 < (*.f64 y #s(literal 4 binary64))

    1. Initial program 91.7%

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

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

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

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

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

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

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

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

Alternative 3: 94.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.8%

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

    if 2e297 < (*.f64 z z)

    1. Initial program 69.0%

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(\frac{y \cdot {z}^{2}}{t} \cdot 4 + \color{blue}{\left(-y \cdot 4\right)}\right) \]
      6. distribute-lft-neg-in69.0%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \color{blue}{\left(\frac{y \cdot {z}^{2}}{t} - y\right)}\right) \]
      9. associate-/l*69.0%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{z \cdot z}}{t} - y\right)\right) \]
      2. *-un-lft-identity69.0%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z \cdot z}{\color{blue}{1 \cdot t}} - y\right)\right) \]
      3. times-frac71.8%

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

      \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{1} \cdot \frac{z}{t}\right)} - y\right)\right) \]
    8. Step-by-step derivation
      1. clear-num71.8%

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\frac{z \cdot 1}{1 \cdot \frac{t}{z}}} - y\right)\right) \]
      3. metadata-eval71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z \cdot \color{blue}{\frac{1}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      4. div-inv71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{\frac{z}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      5. /-rgt-identity71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{z}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      6. metadata-eval71.8%

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\color{blue}{\frac{1 \cdot t}{1 \cdot z}}} - y\right)\right) \]
      8. *-un-lft-identity71.8%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\frac{\color{blue}{t}}{1 \cdot z}} - y\right)\right) \]
      9. *-un-lft-identity71.8%

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(\color{blue}{\frac{\frac{y \cdot z}{t}}{\frac{1}{z}}} - y\right)\right) \]
    11. Applied egg-rr81.7%

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

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

Alternative 4: 94.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 97.8%

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

    if 9.9999999999999994e303 < (*.f64 z z)

    1. Initial program 68.0%

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

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

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

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(\frac{y \cdot {z}^{2}}{t} \cdot 4 + \color{blue}{\left(-y \cdot 4\right)}\right) \]
      6. distribute-lft-neg-in68.0%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \color{blue}{\left(\frac{y \cdot {z}^{2}}{t} - y\right)}\right) \]
      9. associate-/l*68.1%

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

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

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

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

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

      \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \color{blue}{\left(\frac{z}{1} \cdot \frac{z}{t}\right)} - y\right)\right) \]
    8. Step-by-step derivation
      1. clear-num70.9%

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

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{\color{blue}{\frac{z}{1}}}{1 \cdot \frac{t}{z}} - y\right)\right) \]
      5. /-rgt-identity70.9%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\color{blue}{\frac{1 \cdot t}{1 \cdot z}}} - y\right)\right) \]
      8. *-un-lft-identity70.9%

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(y \cdot \frac{z}{\frac{\color{blue}{t}}{1 \cdot z}} - y\right)\right) \]
      9. *-un-lft-identity70.9%

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

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

        \[\leadsto x \cdot x - t \cdot \left(4 \cdot \left(\color{blue}{\frac{y \cdot z}{\frac{t}{z}}} - y\right)\right) \]
    11. Applied egg-rr76.7%

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

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

Alternative 5: 92.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+249}:\\ \;\;\;\;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) 2e+249) (+ (* 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) <= 2e+249) {
		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) <= 2d+249) 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) <= 2e+249) {
		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) <= 2e+249:
		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) <= 2e+249)
		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) <= 2e+249)
		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], 2e+249], 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 \cdot 10^{+249}:\\
\;\;\;\;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) < 1.9999999999999998e249

    1. Initial program 91.2%

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

    if 1.9999999999999998e249 < (*.f64 x x)

    1. Initial program 87.3%

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

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

      \[\leadsto x \cdot x - \color{blue}{0} \]
    5. Step-by-step derivation
      1. --rgt-identity94.4%

        \[\leadsto \color{blue}{x \cdot x} \]
    6. Applied egg-rr94.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+249}:\\ \;\;\;\;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 6: 57.2% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 93.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 55.9%

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

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

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

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

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

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

    if 9.9999999999999997e-241 < (*.f64 x x) < 4.99999999999999967e-89

    1. Initial program 86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 45.9%

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

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

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

    if 4.99999999999999967e-89 < (*.f64 x x)

    1. Initial program 89.1%

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

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

      \[\leadsto x \cdot x - \color{blue}{0} \]
    5. Step-by-step derivation
      1. --rgt-identity69.0%

        \[\leadsto \color{blue}{x \cdot x} \]
    6. Applied egg-rr69.0%

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

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

Alternative 7: 82.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.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 0 87.4%

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

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

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

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

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

    if 9.9999999999999998e185 < (*.f64 z z)

    1. Initial program 73.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 74.5%

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

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

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

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

        \[\leadsto \left(y \cdot -4\right) \cdot \color{blue}{\left(z \cdot z\right)} \]
      2. /-rgt-identity74.5%

        \[\leadsto \left(y \cdot -4\right) \cdot \left(\color{blue}{\frac{z}{1}} \cdot z\right) \]
      3. clear-num74.5%

        \[\leadsto \left(y \cdot -4\right) \cdot \left(\color{blue}{\frac{1}{\frac{1}{z}}} \cdot z\right) \]
      4. /-rgt-identity74.5%

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

        \[\leadsto \left(y \cdot -4\right) \cdot \color{blue}{\frac{1 \cdot z}{\frac{1}{z} \cdot 1}} \]
      6. *-un-lft-identity74.5%

        \[\leadsto \left(y \cdot -4\right) \cdot \frac{\color{blue}{z}}{\frac{1}{z} \cdot 1} \]
    9. Applied egg-rr74.5%

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

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

Alternative 8: 82.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 98.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 0 87.4%

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

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

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

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

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

    if 1.01999999999999999e186 < (*.f64 z z)

    1. Initial program 73.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around inf 74.5%

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

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

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

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

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

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

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

Alternative 9: 58.8% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 91.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in t around inf 47.4%

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

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

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

    if 9.00000000000000031e-84 < (*.f64 x x)

    1. Initial program 89.1%

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

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

      \[\leadsto x \cdot x - \color{blue}{0} \]
    5. Step-by-step derivation
      1. --rgt-identity69.0%

        \[\leadsto \color{blue}{x \cdot x} \]
    6. Applied egg-rr69.0%

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

Alternative 10: 41.2% accurate, 4.3× speedup?

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

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

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

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

    \[\leadsto x \cdot x - \color{blue}{0} \]
  5. Step-by-step derivation
    1. --rgt-identity40.8%

      \[\leadsto \color{blue}{x \cdot x} \]
  6. Applied egg-rr40.8%

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

Developer Target 1: 91.1% 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 2024139 
(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))))