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

Percentage Accurate: 91.5% → 95.8%
Time: 3.7s
Alternatives: 8
Speedup: 0.9×

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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 8 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.5% 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 93.8%

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      5. lift--.f64N/A

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      6. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      7. pow2N/A

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

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      12. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{-4} \cdot \left(y \cdot \left({z}^{2} - t\right)\right) \]
      13. +-commutativeN/A

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left({z}^{2} - t\right)} + {x}^{2} \]
      15. pow2N/A

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

        \[\leadsto \color{blue}{\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)} + {x}^{2} \]
      17. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot z - t, -4 \cdot y, {x}^{2}\right)} \]
    4. Applied rewrites95.6%

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

    if 4.5000000000000001e153 < z

    1. Initial program 77.6%

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

      \[\leadsto 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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6477.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites77.6%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6491.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites91.6%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 59.7% accurate, 0.8× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} t_1 := \left(4 \cdot t\right) \cdot y\\ \mathbf{if}\;z\_m \leq 2.6 \cdot 10^{-178}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z\_m \leq 2.9 \cdot 10^{-111}:\\ \;\;\;\;x \cdot x\\ \mathbf{elif}\;z\_m \leq 4 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z\_m \cdot y\right) \cdot z\_m\right) \cdot -4\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (let* ((t_1 (* (* 4.0 t) y)))
   (if (<= z_m 2.6e-178)
     t_1
     (if (<= z_m 2.9e-111)
       (* x x)
       (if (<= z_m 4e+21) t_1 (* (* (* z_m y) z_m) -4.0))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double t_1 = (4.0 * t) * y;
	double tmp;
	if (z_m <= 2.6e-178) {
		tmp = t_1;
	} else if (z_m <= 2.9e-111) {
		tmp = x * x;
	} else if (z_m <= 4e+21) {
		tmp = t_1;
	} else {
		tmp = ((z_m * y) * z_m) * -4.0;
	}
	return tmp;
}
z_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z_m, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (4.0d0 * t) * y
    if (z_m <= 2.6d-178) then
        tmp = t_1
    else if (z_m <= 2.9d-111) then
        tmp = x * x
    else if (z_m <= 4d+21) then
        tmp = t_1
    else
        tmp = ((z_m * y) * z_m) * (-4.0d0)
    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 t_1 = (4.0 * t) * y;
	double tmp;
	if (z_m <= 2.6e-178) {
		tmp = t_1;
	} else if (z_m <= 2.9e-111) {
		tmp = x * x;
	} else if (z_m <= 4e+21) {
		tmp = t_1;
	} else {
		tmp = ((z_m * y) * z_m) * -4.0;
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	t_1 = (4.0 * t) * y
	tmp = 0
	if z_m <= 2.6e-178:
		tmp = t_1
	elif z_m <= 2.9e-111:
		tmp = x * x
	elif z_m <= 4e+21:
		tmp = t_1
	else:
		tmp = ((z_m * y) * z_m) * -4.0
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	t_1 = Float64(Float64(4.0 * t) * y)
	tmp = 0.0
	if (z_m <= 2.6e-178)
		tmp = t_1;
	elseif (z_m <= 2.9e-111)
		tmp = Float64(x * x);
	elseif (z_m <= 4e+21)
		tmp = t_1;
	else
		tmp = Float64(Float64(Float64(z_m * y) * z_m) * -4.0);
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	t_1 = (4.0 * t) * y;
	tmp = 0.0;
	if (z_m <= 2.6e-178)
		tmp = t_1;
	elseif (z_m <= 2.9e-111)
		tmp = x * x;
	elseif (z_m <= 4e+21)
		tmp = t_1;
	else
		tmp = ((z_m * y) * z_m) * -4.0;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z$95$m, 2.6e-178], t$95$1, If[LessEqual[z$95$m, 2.9e-111], N[(x * x), $MachinePrecision], If[LessEqual[z$95$m, 4e+21], t$95$1, N[(N[(N[(z$95$m * y), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]]]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
t_1 := \left(4 \cdot t\right) \cdot y\\
\mathbf{if}\;z\_m \leq 2.6 \cdot 10^{-178}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z\_m \leq 2.9 \cdot 10^{-111}:\\
\;\;\;\;x \cdot x\\

\mathbf{elif}\;z\_m \leq 4 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < 2.59999999999999998e-178 or 2.90000000000000002e-111 < z < 4e21

    1. Initial program 92.8%

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

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

        \[\leadsto x \cdot \color{blue}{x} \]
      2. lift-*.f6439.6

        \[\leadsto x \cdot \color{blue}{x} \]
    5. Applied rewrites39.6%

      \[\leadsto \color{blue}{x \cdot x} \]
    6. Taylor expanded in t around inf

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

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

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

        \[\leadsto \left(y \cdot t\right) \cdot 4 \]
      4. lower-*.f6437.6

        \[\leadsto \left(y \cdot t\right) \cdot 4 \]
    8. Applied rewrites37.6%

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot t\right) \cdot \color{blue}{y} \]
      7. lower-*.f6437.6

        \[\leadsto \left(4 \cdot t\right) \cdot y \]
    10. Applied rewrites37.6%

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

    if 2.59999999999999998e-178 < z < 2.90000000000000002e-111

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \color{blue}{x} \]
      2. lift-*.f6481.1

        \[\leadsto x \cdot \color{blue}{x} \]
    5. Applied rewrites81.1%

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

    if 4e21 < z

    1. Initial program 85.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

      \[\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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6483.3

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites83.3%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6491.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites91.6%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    8. Taylor expanded in z around inf

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

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

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

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

        \[\leadsto \left(\left(y \cdot z\right) \cdot z\right) \cdot -4 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      7. lift-*.f6484.6

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
    10. Applied rewrites84.6%

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

Alternative 3: 89.9% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z\_m \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(\left(z\_m \cdot z\_m\right) \cdot y, -4, x \cdot x\right)\\

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


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

    1. Initial program 93.6%

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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

        \[\leadsto {x}^{2} + \color{blue}{\left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

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

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

        \[\leadsto \left(t \cdot y\right) \cdot 4 + {\color{blue}{x}}^{2} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, \color{blue}{4}, {x}^{2}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, {x}^{2}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      8. lift-*.f6472.8

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
    5. Applied rewrites72.8%

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

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      2. lift-fma.f64N/A

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

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

        \[\leadsto 4 \cdot \left(t \cdot y\right) + \color{blue}{x} \cdot x \]
      5. associate-*r*N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + \color{blue}{x} \cdot x \]
      6. pow2N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + {x}^{\color{blue}{2}} \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, \color{blue}{y}, {x}^{2}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, {x}^{2}\right) \]
      9. pow2N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
      10. lift-*.f6474.8

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
    7. Applied rewrites74.8%

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

    if 7.2e21 < z < 2.00000000000000003e151

    1. Initial program 95.6%

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

      \[\leadsto \color{blue}{{x}^{2} - 4 \cdot \left(y \cdot {z}^{2}\right)} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

        \[\leadsto {x}^{2} + -4 \cdot \left(\color{blue}{y} \cdot {z}^{2}\right) \]
      3. +-commutativeN/A

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

        \[\leadsto \left(y \cdot {z}^{2}\right) \cdot -4 + {\color{blue}{x}}^{2} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(y \cdot {z}^{2}, \color{blue}{-4}, {x}^{2}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left({z}^{2} \cdot y, -4, {x}^{2}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left({z}^{2} \cdot y, -4, {x}^{2}\right) \]
      8. pow2N/A

        \[\leadsto \mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, {x}^{2}\right) \]
      9. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, {x}^{2}\right) \]
      10. pow2N/A

        \[\leadsto \mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, x \cdot x\right) \]
      11. lift-*.f6491.4

        \[\leadsto \mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, x \cdot x\right) \]
    5. Applied rewrites91.4%

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

    if 2.00000000000000003e151 < z

    1. Initial program 77.6%

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

      \[\leadsto 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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6477.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites77.6%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6491.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites91.6%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    8. Taylor expanded in z around inf

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

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

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

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

        \[\leadsto \left(\left(y \cdot z\right) \cdot z\right) \cdot -4 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      7. lift-*.f6494.0

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
    10. Applied rewrites94.0%

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

Alternative 4: 86.8% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;z\_m \leq 5 \cdot 10^{+126}:\\
\;\;\;\;\left(-4 \cdot y\right) \cdot \mathsf{fma}\left(z\_m, z\_m, -t\right)\\

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


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

    1. Initial program 93.1%

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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

        \[\leadsto {x}^{2} + \color{blue}{\left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

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

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

        \[\leadsto \left(t \cdot y\right) \cdot 4 + {\color{blue}{x}}^{2} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, \color{blue}{4}, {x}^{2}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, {x}^{2}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      8. lift-*.f6472.6

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
    5. Applied rewrites72.6%

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

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      2. lift-fma.f64N/A

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

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

        \[\leadsto 4 \cdot \left(t \cdot y\right) + \color{blue}{x} \cdot x \]
      5. associate-*r*N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + \color{blue}{x} \cdot x \]
      6. pow2N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + {x}^{\color{blue}{2}} \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, \color{blue}{y}, {x}^{2}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, {x}^{2}\right) \]
      9. pow2N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
      10. lift-*.f6475.1

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
    7. Applied rewrites75.1%

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

    if 8.1999999999999996e37 < z < 4.99999999999999977e126

    1. Initial program 99.8%

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

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

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

        \[\leadsto \left(-4 \cdot y\right) \cdot \left(z \cdot z - t\right) \]
      3. lower-*.f64N/A

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

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

        \[\leadsto \left(-4 \cdot y\right) \cdot \left({z}^{2} - t\right) \]
      6. *-lft-identityN/A

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

        \[\leadsto \left(-4 \cdot y\right) \cdot \left({z}^{2} - \left(\mathsf{neg}\left(-1\right)\right) \cdot t\right) \]
      8. fp-cancel-sign-sub-invN/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \left({z}^{2} + \color{blue}{-1 \cdot t}\right) \]
      9. pow2N/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \left(z \cdot z + \color{blue}{-1} \cdot t\right) \]
      10. lower-fma.f64N/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \mathsf{fma}\left(z, \color{blue}{z}, -1 \cdot t\right) \]
      11. mul-1-negN/A

        \[\leadsto \left(-4 \cdot y\right) \cdot \mathsf{fma}\left(z, z, \mathsf{neg}\left(t\right)\right) \]
      12. lower-neg.f6484.5

        \[\leadsto \left(-4 \cdot y\right) \cdot \mathsf{fma}\left(z, z, -t\right) \]
    5. Applied rewrites84.5%

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

    if 4.99999999999999977e126 < z

    1. Initial program 79.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

      \[\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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6479.4

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites79.4%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6492.3

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites92.3%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    8. Taylor expanded in z around inf

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

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

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

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

        \[\leadsto \left(\left(y \cdot z\right) \cdot z\right) \cdot -4 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      7. lift-*.f6491.9

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
    10. Applied rewrites91.9%

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

Alternative 5: 96.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 93.8%

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

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

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

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

        \[\leadsto x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      5. lift--.f64N/A

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z - t\right)} \]
      6. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \left(\color{blue}{z \cdot z} - t\right) \]
      7. pow2N/A

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

        \[\leadsto {x}^{2} - \color{blue}{\left(4 \cdot y\right)} \cdot \left(z \cdot z - t\right) \]
      9. pow2N/A

        \[\leadsto {x}^{2} - \left(4 \cdot y\right) \cdot \left(\color{blue}{{z}^{2}} - t\right) \]
      10. associate-*r*N/A

        \[\leadsto {x}^{2} - \color{blue}{4 \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      11. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{{x}^{2} + \left(\mathsf{neg}\left(4\right)\right) \cdot \left(y \cdot \left({z}^{2} - t\right)\right)} \]
      12. metadata-evalN/A

        \[\leadsto {x}^{2} + \color{blue}{-4} \cdot \left(y \cdot \left({z}^{2} - t\right)\right) \]
      13. +-commutativeN/A

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

        \[\leadsto \color{blue}{\left(-4 \cdot y\right) \cdot \left({z}^{2} - t\right)} + {x}^{2} \]
      15. pow2N/A

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

        \[\leadsto \color{blue}{\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)} + {x}^{2} \]
      17. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(z \cdot z - t, -4 \cdot y, {x}^{2}\right)} \]
    4. Applied rewrites95.6%

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

    if 2.00000000000000003e151 < z

    1. Initial program 77.6%

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

      \[\leadsto 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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6477.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites77.6%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6491.6

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites91.6%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    8. Taylor expanded in z around inf

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

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

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

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

        \[\leadsto \left(\left(y \cdot z\right) \cdot z\right) \cdot -4 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      7. lift-*.f6494.0

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
    10. Applied rewrites94.0%

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

Alternative 6: 84.8% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 93.1%

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

      \[\leadsto \color{blue}{{x}^{2} - -4 \cdot \left(t \cdot y\right)} \]
    4. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

        \[\leadsto {x}^{2} + \color{blue}{\left(\mathsf{neg}\left(-4\right)\right) \cdot \left(t \cdot y\right)} \]
      2. metadata-evalN/A

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

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

        \[\leadsto \left(t \cdot y\right) \cdot 4 + {\color{blue}{x}}^{2} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, \color{blue}{4}, {x}^{2}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, {x}^{2}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      8. lift-*.f6472.6

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
    5. Applied rewrites72.6%

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

        \[\leadsto \mathsf{fma}\left(t \cdot y, 4, x \cdot x\right) \]
      2. lift-fma.f64N/A

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

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

        \[\leadsto 4 \cdot \left(t \cdot y\right) + \color{blue}{x} \cdot x \]
      5. associate-*r*N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + \color{blue}{x} \cdot x \]
      6. pow2N/A

        \[\leadsto \left(4 \cdot t\right) \cdot y + {x}^{\color{blue}{2}} \]
      7. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, \color{blue}{y}, {x}^{2}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, {x}^{2}\right) \]
      9. pow2N/A

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
      10. lift-*.f6475.1

        \[\leadsto \mathsf{fma}\left(4 \cdot t, y, x \cdot x\right) \]
    7. Applied rewrites75.1%

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

    if 1.3e38 < z

    1. Initial program 86.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

      \[\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. *-commutativeN/A

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

        \[\leadsto x \cdot x - \left(-4 \cdot y + 4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot \color{blue}{t} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - \left(\mathsf{neg}\left(4\right)\right) \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      4. metadata-evalN/A

        \[\leadsto x \cdot x - \left(-4 \cdot y - -4 \cdot \frac{y \cdot {z}^{2}}{t}\right) \cdot t \]
      5. distribute-lft-out--N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      6. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      7. lower--.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      8. lower-/.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{y \cdot {z}^{2}}{t}\right)\right) \cdot t \]
      9. *-commutativeN/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      10. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{{z}^{2} \cdot y}{t}\right)\right) \cdot t \]
      11. pow2N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      12. lift-*.f6484.5

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
    5. Applied rewrites84.5%

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

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      2. lift-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{\left(z \cdot z\right) \cdot y}{t}\right)\right) \cdot t \]
      3. associate-*l*N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      4. lower-*.f64N/A

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
      5. lower-*.f6493.0

        \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    7. Applied rewrites93.0%

      \[\leadsto x \cdot x - \left(-4 \cdot \left(y - \frac{z \cdot \left(z \cdot y\right)}{t}\right)\right) \cdot t \]
    8. Taylor expanded in z around inf

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

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

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

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

        \[\leadsto \left(\left(y \cdot z\right) \cdot z\right) \cdot -4 \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
      7. lift-*.f6485.8

        \[\leadsto \left(\left(z \cdot y\right) \cdot z\right) \cdot -4 \]
    10. Applied rewrites85.8%

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

Alternative 7: 45.4% accurate, 1.6× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 3700000:\\ \;\;\;\;\left(4 \cdot t\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot x\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
 :precision binary64
 (if (<= x 3700000.0) (* (* 4.0 t) y) (* x x)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	double tmp;
	if (x <= 3700000.0) {
		tmp = (4.0 * t) * y;
	} else {
		tmp = x * x;
	}
	return tmp;
}
z_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z_m, t)
use fmin_fmax_functions
    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 (x <= 3700000.0d0) then
        tmp = (4.0d0 * t) * y
    else
        tmp = x * x
    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 (x <= 3700000.0) {
		tmp = (4.0 * t) * y;
	} else {
		tmp = x * x;
	}
	return tmp;
}
z_m = math.fabs(z)
def code(x, y, z_m, t):
	tmp = 0
	if x <= 3700000.0:
		tmp = (4.0 * t) * y
	else:
		tmp = x * x
	return tmp
z_m = abs(z)
function code(x, y, z_m, t)
	tmp = 0.0
	if (x <= 3700000.0)
		tmp = Float64(Float64(4.0 * t) * y);
	else
		tmp = Float64(x * x);
	end
	return tmp
end
z_m = abs(z);
function tmp_2 = code(x, y, z_m, t)
	tmp = 0.0;
	if (x <= 3700000.0)
		tmp = (4.0 * t) * y;
	else
		tmp = x * x;
	end
	tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := If[LessEqual[x, 3700000.0], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3700000:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\

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


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

    1. Initial program 92.2%

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

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

        \[\leadsto x \cdot \color{blue}{x} \]
      2. lift-*.f6429.0

        \[\leadsto x \cdot \color{blue}{x} \]
    5. Applied rewrites29.0%

      \[\leadsto \color{blue}{x \cdot x} \]
    6. Taylor expanded in t around inf

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

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

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

        \[\leadsto \left(y \cdot t\right) \cdot 4 \]
      4. lower-*.f6437.3

        \[\leadsto \left(y \cdot t\right) \cdot 4 \]
    8. Applied rewrites37.3%

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot t\right) \cdot \color{blue}{y} \]
      7. lower-*.f6437.3

        \[\leadsto \left(4 \cdot t\right) \cdot y \]
    10. Applied rewrites37.3%

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

    if 3.7e6 < x

    1. Initial program 89.8%

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

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

        \[\leadsto x \cdot \color{blue}{x} \]
      2. lift-*.f6478.4

        \[\leadsto x \cdot \color{blue}{x} \]
    5. Applied rewrites78.4%

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

Alternative 8: 41.4% accurate, 4.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ x \cdot x \end{array} \]
z_m = (fabs.f64 z)
(FPCore (x y z_m t) :precision binary64 (* x x))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
	return x * x;
}
z_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

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

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

      \[\leadsto x \cdot \color{blue}{x} \]
    2. lift-*.f6440.2

      \[\leadsto x \cdot \color{blue}{x} \]
  5. Applied rewrites40.2%

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

Developer Target 1: 91.5% 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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 2025057 
(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))))