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

Percentage Accurate: 90.8% → 98.5%
Time: 3.4s
Alternatives: 9
Speedup: 0.7×

Specification

?
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
(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]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 90.8% accurate, 1.0× speedup?

\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
(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]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)

Alternative 1: 98.5% accurate, 0.5× speedup?

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

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


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

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

    if 5e152 < z

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
      6. distribute-lft-neg-outN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
      9. sub-negate-revN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
      12. associate-*l*N/A

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

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

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

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

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

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

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

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

Alternative 2: 95.4% accurate, 0.6× speedup?

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

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


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

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000009e153 < z

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z - t\right)} + x \cdot x \]
      6. sub-flipN/A

        \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(4 \cdot \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z \cdot z\right) - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
      12. associate-*l*N/A

        \[\leadsto \left(\color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right)} - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
      13. distribute-lft-neg-outN/A

        \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right) + x \cdot x \]
      14. distribute-lft-neg-outN/A

        \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right)\right)\right) + x \cdot x \]
      15. remove-double-negN/A

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

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

        \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(4 \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
      18. associate-*l*N/A

        \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{4 \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)}\right) + x \cdot x \]
      19. distribute-lft-out--N/A

        \[\leadsto \color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right) - y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
    3. Applied rewrites93.4%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{\left(\mathsf{neg}\left(\left(-t\right)\right)\right) \cdot y + \left(\left(-y\right) \cdot z\right) \cdot z}, x \cdot x\right) \]
      5. add-flipN/A

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

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{\left(\mathsf{neg}\left(\left(-t\right)\right)\right) \cdot y - \left(\mathsf{neg}\left(\left(\left(-y\right) \cdot z\right) \cdot z\right)\right)}, x \cdot x\right) \]
      7. distribute-lft-neg-outN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(4, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot y\right)\right) - \left(\mathsf{neg}\left(\left(\left(-y\right) \cdot z\right) \cdot z\right)\right), x \cdot x\right) \]
      11. distribute-lft-neg-outN/A

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

        \[\leadsto \mathsf{fma}\left(4, \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{t \cdot y}\right)\right)\right)\right) - \left(\mathsf{neg}\left(\left(\left(-y\right) \cdot z\right) \cdot z\right)\right), x \cdot x\right) \]
      13. remove-double-negN/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right) \cdot \color{blue}{\left(z \cdot z\right)}\right)\right), x \cdot x\right) \]
      19. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y \cdot \left(z \cdot z\right)\right)\right)}\right)\right), x \cdot x\right) \]
      20. remove-double-negN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - y \cdot \color{blue}{\left(z \cdot z\right)}, x \cdot x\right) \]
      4. sqr-neg-revN/A

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

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \color{blue}{\left(y \cdot \left(\mathsf{neg}\left(z\right)\right)\right) \cdot \left(\mathsf{neg}\left(z\right)\right)}, x \cdot x\right) \]
      6. remove-double-divN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \color{blue}{\frac{1}{\frac{1}{\mathsf{neg}\left(z\right)}}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\mathsf{neg}\left(z\right)}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      8. frac-2negN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \frac{1}{\color{blue}{\frac{-1}{z}}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      9. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \frac{1}{\color{blue}{\frac{-1}{z}}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \frac{\color{blue}{\mathsf{neg}\left(-1\right)}}{\frac{-1}{z}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \left(y \cdot \frac{\color{blue}{1}}{\frac{-1}{z}}\right) \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      12. mult-flipN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \color{blue}{\frac{y}{\frac{-1}{z}}} \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      13. frac-2negN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \color{blue}{\frac{\mathsf{neg}\left(y\right)}{\mathsf{neg}\left(\frac{-1}{z}\right)}} \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      14. distribute-frac-neg2N/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(y\right)}{\frac{-1}{z}}\right)\right)} \cdot \left(\mathsf{neg}\left(z\right)\right), x \cdot x\right) \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(y\right)}{\frac{-1}{z}} \cdot \left(\mathsf{neg}\left(z\right)\right)\right)\right)}, x \cdot x\right) \]
      16. distribute-rgt-neg-inN/A

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

        \[\leadsto \mathsf{fma}\left(4, t \cdot y - \frac{\mathsf{neg}\left(y\right)}{\frac{-1}{z}} \cdot \color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(z\right)\right)\right)}, x \cdot x\right) \]
      18. distribute-rgt-neg-inN/A

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

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

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

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

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

Alternative 3: 94.1% accurate, 0.7× speedup?

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

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


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

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
      6. distribute-lft-neg-outN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
      9. sub-negate-revN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
      12. associate-*l*N/A

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

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

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

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

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

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

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

    if 1.34999999999999998e191 < x

    1. Initial program 90.8%

      \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
    2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
      3. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
      6. distribute-lft-neg-outN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
      9. sub-negate-revN/A

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
      12. associate-*l*N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(x, x, \left(\color{blue}{t} \cdot y\right) \cdot 4\right) \]
    5. Step-by-step derivation
      1. Applied rewrites67.1%

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 85.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \mathbf{if}\;\left|z\right| \leq 5.5 \cdot 10^{+24}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left|z\right|, \left|z\right|, t\right), -4 \cdot y, x \cdot x\right)\\ \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (if (<= (fabs z) 5.5e+24)
       (fma (* t 4.0) y (* x x))
       (fma (fma (fabs z) (fabs z) t) (* -4.0 y) (* x x))))
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if (fabs(z) <= 5.5e+24) {
    		tmp = fma((t * 4.0), y, (x * x));
    	} else {
    		tmp = fma(fma(fabs(z), fabs(z), t), (-4.0 * y), (x * x));
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	tmp = 0.0
    	if (abs(z) <= 5.5e+24)
    		tmp = fma(Float64(t * 4.0), y, Float64(x * x));
    	else
    		tmp = fma(fma(abs(z), abs(z), t), Float64(-4.0 * y), Float64(x * x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := If[LessEqual[N[Abs[z], $MachinePrecision], 5.5e+24], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision] + t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    \mathbf{if}\;\left|z\right| \leq 5.5 \cdot 10^{+24}:\\
    \;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left|z\right|, \left|z\right|, t\right), -4 \cdot y, x \cdot x\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < 5.5000000000000002e24

      1. Initial program 90.8%

        \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
      2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
        3. fp-cancel-sub-sign-invN/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
        6. distribute-lft-neg-outN/A

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

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

          \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
        9. sub-negate-revN/A

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

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

          \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
        12. associate-*l*N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x, x, \left(\color{blue}{t} \cdot y\right) \cdot 4\right) \]
      5. Step-by-step derivation
        1. Applied rewrites67.1%

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

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

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

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

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

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

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

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

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

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

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

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

        if 5.5000000000000002e24 < z

        1. Initial program 90.8%

          \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
        2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
          3. fp-cancel-sub-sign-invN/A

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

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

            \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z - t\right)} + x \cdot x \]
          6. sub-flipN/A

            \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
          7. distribute-lft-inN/A

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

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

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

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

            \[\leadsto \left(\color{blue}{\left(4 \cdot \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z \cdot z\right) - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
          12. associate-*l*N/A

            \[\leadsto \left(\color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right)} - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
          13. distribute-lft-neg-outN/A

            \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right) + x \cdot x \]
          14. distribute-lft-neg-outN/A

            \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right)\right)\right) + x \cdot x \]
          15. remove-double-negN/A

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

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

            \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(4 \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
          18. associate-*l*N/A

            \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{4 \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)}\right) + x \cdot x \]
          19. distribute-lft-out--N/A

            \[\leadsto \color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right) - y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
        3. Applied rewrites93.4%

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

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

      Alternative 5: 85.4% accurate, 0.7× speedup?

      \[\begin{array}{l} \mathbf{if}\;\left|z\right| \leq 3.8 \cdot 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \mathsf{fma}\left(\left|z\right|, \left|z\right|, t\right) \cdot \left(-4 \cdot y\right)\right)\\ \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= (fabs z) 3.8e+63)
         (fma (* t 4.0) y (* x x))
         (fma x x (* (fma (fabs z) (fabs z) t) (* -4.0 y)))))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if (fabs(z) <= 3.8e+63) {
      		tmp = fma((t * 4.0), y, (x * x));
      	} else {
      		tmp = fma(x, x, (fma(fabs(z), fabs(z), t) * (-4.0 * y)));
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (abs(z) <= 3.8e+63)
      		tmp = fma(Float64(t * 4.0), y, Float64(x * x));
      	else
      		tmp = fma(x, x, Float64(fma(abs(z), abs(z), t) * Float64(-4.0 * y)));
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[N[Abs[z], $MachinePrecision], 3.8e+63], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(N[(N[Abs[z], $MachinePrecision] * N[Abs[z], $MachinePrecision] + t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      \mathbf{if}\;\left|z\right| \leq 3.8 \cdot 10^{+63}:\\
      \;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(x, x, \mathsf{fma}\left(\left|z\right|, \left|z\right|, t\right) \cdot \left(-4 \cdot y\right)\right)\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < 3.8000000000000001e63

        1. Initial program 90.8%

          \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
        2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
          3. fp-cancel-sub-sign-invN/A

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
          6. distribute-lft-neg-outN/A

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

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

            \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
          9. sub-negate-revN/A

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

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

            \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
          12. associate-*l*N/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x, \left(\color{blue}{t} \cdot y\right) \cdot 4\right) \]
        5. Step-by-step derivation
          1. Applied rewrites67.1%

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

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

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

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

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

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

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

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

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

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

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

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

          if 3.8000000000000001e63 < z

          1. Initial program 90.8%

            \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
          2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
            3. fp-cancel-sub-sign-invN/A

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
            6. distribute-lft-neg-outN/A

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

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

              \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
            9. sub-negate-revN/A

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

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

              \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
            12. associate-*l*N/A

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

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

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

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

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

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

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

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

        Alternative 6: 67.1% accurate, 1.5× speedup?

        \[\mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right) \]
        (FPCore (x y z t) :precision binary64 (fma x x (* (* t y) 4.0)))
        double code(double x, double y, double z, double t) {
        	return fma(x, x, ((t * y) * 4.0));
        }
        
        function code(x, y, z, t)
        	return fma(x, x, Float64(Float64(t * y) * 4.0))
        end
        
        code[x_, y_, z_, t_] := N[(x * x + N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]
        
        \mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right)
        
        Derivation
        1. Initial program 90.8%

          \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
        2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
          3. fp-cancel-sub-sign-invN/A

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
          6. distribute-lft-neg-outN/A

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

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

            \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
          9. sub-negate-revN/A

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

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

            \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
          12. associate-*l*N/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x, \left(\color{blue}{t} \cdot y\right) \cdot 4\right) \]
        5. Step-by-step derivation
          1. Applied rewrites67.1%

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

          Alternative 7: 58.5% accurate, 0.9× speedup?

          \[\begin{array}{l} \mathbf{if}\;\left|x\right| \leq 20500000:\\ \;\;\;\;4 \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left|x\right|, \left|x\right|, t \cdot \left(-4 \cdot y\right)\right)\\ \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (<= (fabs x) 20500000.0)
             (* 4.0 (* t y))
             (fma (fabs x) (fabs x) (* t (* -4.0 y)))))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if (fabs(x) <= 20500000.0) {
          		tmp = 4.0 * (t * y);
          	} else {
          		tmp = fma(fabs(x), fabs(x), (t * (-4.0 * y)));
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if (abs(x) <= 20500000.0)
          		tmp = Float64(4.0 * Float64(t * y));
          	else
          		tmp = fma(abs(x), abs(x), Float64(t * Float64(-4.0 * y)));
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_] := If[LessEqual[N[Abs[x], $MachinePrecision], 20500000.0], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision] + N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;\left|x\right| \leq 20500000:\\
          \;\;\;\;4 \cdot \left(t \cdot y\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\left|x\right|, \left|x\right|, t \cdot \left(-4 \cdot y\right)\right)\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 2.05e7

            1. Initial program 90.8%

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

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

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

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

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

            if 2.05e7 < x

            1. Initial program 90.8%

              \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
            2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
              3. fp-cancel-sub-sign-invN/A

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(z \cdot z - t\right)\right)} \]
              6. distribute-lft-neg-outN/A

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

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

                \[\leadsto \mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(\color{blue}{\left(z \cdot z - t\right)}\right)\right)\right) \]
              9. sub-negate-revN/A

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

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

                \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{\left(4 \cdot y\right)} \cdot \left(t - z \cdot z\right)\right) \]
              12. associate-*l*N/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(x, x, \color{blue}{t} \cdot \left(-4 \cdot y\right)\right) \]
            6. Step-by-step derivation
              1. Applied rewrites42.0%

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

            Alternative 8: 30.8% accurate, 2.6× speedup?

            \[4 \cdot \left(t \cdot y\right) \]
            (FPCore (x y z t) :precision binary64 (* 4.0 (* t y)))
            double code(double x, double y, double z, double t) {
            	return 4.0 * (t * y);
            }
            
            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 = 4.0d0 * (t * y)
            end function
            
            public static double code(double x, double y, double z, double t) {
            	return 4.0 * (t * y);
            }
            
            def code(x, y, z, t):
            	return 4.0 * (t * y)
            
            function code(x, y, z, t)
            	return Float64(4.0 * Float64(t * y))
            end
            
            function tmp = code(x, y, z, t)
            	tmp = 4.0 * (t * y);
            end
            
            code[x_, y_, z_, t_] := N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
            
            4 \cdot \left(t \cdot y\right)
            
            Derivation
            1. Initial program 90.8%

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

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

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

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

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

            Alternative 9: 6.2% accurate, 2.6× speedup?

            \[-4 \cdot \left(t \cdot y\right) \]
            (FPCore (x y z t) :precision binary64 (* -4.0 (* t y)))
            double code(double x, double y, double z, double t) {
            	return -4.0 * (t * y);
            }
            
            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 = (-4.0d0) * (t * y)
            end function
            
            public static double code(double x, double y, double z, double t) {
            	return -4.0 * (t * y);
            }
            
            def code(x, y, z, t):
            	return -4.0 * (t * y)
            
            function code(x, y, z, t)
            	return Float64(-4.0 * Float64(t * y))
            end
            
            function tmp = code(x, y, z, t)
            	tmp = -4.0 * (t * y);
            end
            
            code[x_, y_, z_, t_] := N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
            
            -4 \cdot \left(t \cdot y\right)
            
            Derivation
            1. Initial program 90.8%

              \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \]
            2. 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 x \cdot x - \color{blue}{\left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)} \]
              3. fp-cancel-sub-sign-invN/A

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

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

                \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z - t\right)} + x \cdot x \]
              6. sub-flipN/A

                \[\leadsto \left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \color{blue}{\left(z \cdot z + \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
              7. distribute-lft-inN/A

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

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

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

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

                \[\leadsto \left(\color{blue}{\left(4 \cdot \left(\mathsf{neg}\left(y\right)\right)\right)} \cdot \left(z \cdot z\right) - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
              12. associate-*l*N/A

                \[\leadsto \left(\color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right)} - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
              13. distribute-lft-neg-outN/A

                \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y \cdot 4\right)\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right) + x \cdot x \]
              14. distribute-lft-neg-outN/A

                \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\left(y \cdot 4\right) \cdot \left(\mathsf{neg}\left(t\right)\right)\right)\right)}\right)\right)\right) + x \cdot x \]
              15. remove-double-negN/A

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

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

                \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{\left(4 \cdot y\right)} \cdot \left(\mathsf{neg}\left(t\right)\right)\right) + x \cdot x \]
              18. associate-*l*N/A

                \[\leadsto \left(4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right)\right) - \color{blue}{4 \cdot \left(y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)}\right) + x \cdot x \]
              19. distribute-lft-out--N/A

                \[\leadsto \color{blue}{4 \cdot \left(\left(\mathsf{neg}\left(y\right)\right) \cdot \left(z \cdot z\right) - y \cdot \left(\mathsf{neg}\left(t\right)\right)\right)} + x \cdot x \]
            3. Applied rewrites93.4%

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

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

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

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

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

              \[\leadsto \color{blue}{-4 \cdot \left(t \cdot y\right)} \]
            8. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2025171 
            (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))))