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

Percentage Accurate: 90.9% → 94.5%
Time: 12.0s
Alternatives: 6
Speedup: 0.5×

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 6 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.9% 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: 94.5% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;z\_m \leq 7.5 \cdot 10^{+220}:\\
\;\;\;\;x \cdot x + \left(y \cdot \left(t \cdot 4\right) - z\_m \cdot \frac{y \cdot \left(z\_m \cdot \left(t \cdot 4\right)\right)}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 4.6e154

    1. Initial program 95.6%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Step-by-step derivation
      1. fmm-def96.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-in96.9%

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(-y \cdot 4\right) \cdot \left(z \cdot z - t\right)}\right) \]
      3. *-commutative96.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-in96.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-eval96.9%

        \[\leadsto \mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot \color{blue}{-4}\right)\right) \]
    3. Simplified96.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

    if 4.6e154 < z < 7.5000000000000003e220

    1. Initial program 54.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 54.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5000000000000003e220 < z

    1. Initial program 75.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 75.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.3% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 1.85000000000000005e132

    1. Initial program 95.5%

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

    if 1.85000000000000005e132 < z < 5.0000000000000002e220

    1. Initial program 66.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 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e220 < z

    1. Initial program 75.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 75.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 96.8%

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

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

    1. Initial program 67.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.8% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 95.2%

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

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

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

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

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

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

    if 1.2e75 < z

    1. Initial program 78.3%

      \[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 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 67.4% accurate, 1.4× speedup?

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

\\
x \cdot x - y \cdot \left(t \cdot -4\right)
\end{array}
Derivation
  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 0 66.5%

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

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

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

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

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

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

Alternative 6: 31.4% accurate, 2.6× speedup?

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

\\
4 \cdot \left(t \cdot y\right)
\end{array}
Derivation
  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 t around inf 30.6%

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

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

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

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

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

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

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