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

Percentage Accurate: 90.9% → 96.6%
Time: 15.6s
Alternatives: 10
Speedup: 0.8×

Specification

?
\[\begin{array}{l} \\ x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
	return (x * x) - ((y * 4.0) * ((z * z) - t));
}
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}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 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));
}
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: 96.6% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 91.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites96.9%

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

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

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

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

    if 4.99999999999999961e273 < x

    1. Initial program 81.6%

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

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

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

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

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

Alternative 2: 96.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 93.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites97.3%

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

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

    if 1.00000000000000002e151 < z

    1. Initial program 70.4%

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

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

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

Alternative 3: 94.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 93.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites97.3%

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

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

    if 1.00000000000000002e151 < z

    1. Initial program 70.4%

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

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

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

Alternative 4: 94.6% accurate, 0.8× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \mathsf{fma}\left(4 \cdot y, t, \mathsf{fma}\left(z \cdot \left(-4 \cdot y\right), z, x\_m \cdot x\_m\right)\right) \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (fma (* 4.0 y) t (fma (* z (* -4.0 y)) z (* x_m x_m))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return fma((4.0 * y), t, fma((z * (-4.0 * y)), z, (x_m * x_m)));
}
x_m = abs(x)
function code(x_m, y, z, t)
	return fma(Float64(4.0 * y), t, fma(Float64(z * Float64(-4.0 * y)), z, Float64(x_m * x_m)))
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(N[(4.0 * y), $MachinePrecision] * t + N[(N[(z * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * z + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

\\
\mathsf{fma}\left(4 \cdot y, t, \mathsf{fma}\left(z \cdot \left(-4 \cdot y\right), z, x\_m \cdot x\_m\right)\right)
\end{array}
Derivation
  1. Initial program 90.9%

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
  2. Applied rewrites96.6%

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

Alternative 5: 82.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.5000000000000001e-23

    1. Initial program 93.3%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites72.3%

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

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

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

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

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

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

    if 2.5000000000000001e-23 < z

    1. Initial program 84.4%

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

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

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

Alternative 6: 79.0% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.65e-12

    1. Initial program 94.0%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites99.3%

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

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

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

    if 1.65e-12 < x

    1. Initial program 88.1%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites69.8%

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

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

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

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

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

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

Alternative 7: 75.3% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 93.5%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites72.4%

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

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

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

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

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

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

    if 1.32e11 < z

    1. Initial program 82.9%

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

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

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

Alternative 8: 58.8% accurate, 1.3× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;z \leq 2.5 \cdot 10^{-23}:\\ \;\;\;\;\left(t \cdot y\right) \cdot 4\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot \left(-4 \cdot y\right)\right) \cdot z\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t)
 :precision binary64
 (if (<= z 2.5e-23) (* (* t y) 4.0) (* (* z (* -4.0 y)) z)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	double tmp;
	if (z <= 2.5e-23) {
		tmp = (t * y) * 4.0;
	} else {
		tmp = (z * (-4.0 * y)) * z;
	}
	return tmp;
}
x_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_m, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= 2.5d-23) then
        tmp = (t * y) * 4.0d0
    else
        tmp = (z * ((-4.0d0) * y)) * z
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	double tmp;
	if (z <= 2.5e-23) {
		tmp = (t * y) * 4.0;
	} else {
		tmp = (z * (-4.0 * y)) * z;
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	tmp = 0
	if z <= 2.5e-23:
		tmp = (t * y) * 4.0
	else:
		tmp = (z * (-4.0 * y)) * z
	return tmp
x_m = abs(x)
function code(x_m, y, z, t)
	tmp = 0.0
	if (z <= 2.5e-23)
		tmp = Float64(Float64(t * y) * 4.0);
	else
		tmp = Float64(Float64(z * Float64(-4.0 * y)) * z);
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y, z, t)
	tmp = 0.0;
	if (z <= 2.5e-23)
		tmp = (t * y) * 4.0;
	else
		tmp = (z * (-4.0 * y)) * z;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := If[LessEqual[z, 2.5e-23], N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision], N[(N[(z * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.5000000000000001e-23

    1. Initial program 93.3%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites97.6%

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

      \[\leadsto \color{blue}{4 \cdot \left(t \cdot y\right)} \]
    4. Applied rewrites36.8%

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

    if 2.5000000000000001e-23 < z

    1. Initial program 84.4%

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

      \[\leadsto \color{blue}{-4 \cdot \left(y \cdot {z}^{2}\right)} \]
    3. Applied rewrites67.8%

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

Alternative 9: 45.2% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 93.9%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. Applied rewrites99.2%

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

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

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

    if 4.5e33 < x

    1. Initial program 87.2%

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

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

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

        \[\leadsto x \cdot \color{blue}{x} \]
    4. Applied rewrites74.6%

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

Alternative 10: 41.3% accurate, 4.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ x\_m \cdot x\_m \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y z t) :precision binary64 (* x_m x_m))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
	return x_m * x_m;
}
x_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_m, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x_m * x_m
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
	return x_m * x_m;
}
x_m = math.fabs(x)
def code(x_m, y, z, t):
	return x_m * x_m
x_m = abs(x)
function code(x_m, y, z, t)
	return Float64(x_m * x_m)
end
x_m = abs(x);
function tmp = code(x_m, y, z, t)
	tmp = x_m * x_m;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := N[(x$95$m * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2025130 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64
  (- (* x x) (* (* y 4.0) (- (* z z) t))))