Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 3.4s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \left(t - x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y - z) * Float64(t - x)))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y - z) * (t - x));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \left(t - x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y - z) * Float64(t - x)))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y - z) * (t - x));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \left(t - x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y - z) * Float64(t - x)))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y - z) * (t - x));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Derivation
  1. Initial program 100.0%

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

Alternative 2: 75.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-59} \lor \neg \left(x \leq 1.4 \cdot 10^{-34}\right):\\ \;\;\;\;\left(1 - \left(y - z\right)\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -6.5e-59) (not (<= x 1.4e-34)))
   (* (- 1.0 (- y z)) x)
   (* (- y z) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -6.5e-59) || !(x <= 1.4e-34)) {
		tmp = (1.0 - (y - z)) * x;
	} else {
		tmp = (y - z) * t;
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((x <= (-6.5d-59)) .or. (.not. (x <= 1.4d-34))) then
        tmp = (1.0d0 - (y - z)) * x
    else
        tmp = (y - z) * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -6.5e-59) || !(x <= 1.4e-34)) {
		tmp = (1.0 - (y - z)) * x;
	} else {
		tmp = (y - z) * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -6.5e-59) or not (x <= 1.4e-34):
		tmp = (1.0 - (y - z)) * x
	else:
		tmp = (y - z) * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -6.5e-59) || !(x <= 1.4e-34))
		tmp = Float64(Float64(1.0 - Float64(y - z)) * x);
	else
		tmp = Float64(Float64(y - z) * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -6.5e-59) || ~((x <= 1.4e-34)))
		tmp = (1.0 - (y - z)) * x;
	else
		tmp = (y - z) * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e-59], N[Not[LessEqual[x, 1.4e-34]], $MachinePrecision]], N[(N[(1.0 - N[(y - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-59} \lor \neg \left(x \leq 1.4 \cdot 10^{-34}\right):\\
\;\;\;\;\left(1 - \left(y - z\right)\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.50000000000000017e-59 or 1.39999999999999998e-34 < x

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
      5. *-lft-identityN/A

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

        \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
      7. lift--.f6486.8

        \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
    5. Applied rewrites86.8%

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

    if -6.50000000000000017e-59 < x < 1.39999999999999998e-34

    1. Initial program 100.0%

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

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

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

        \[\leadsto \left(y - z\right) \cdot \color{blue}{t} \]
      3. lift--.f6485.3

        \[\leadsto \left(y - z\right) \cdot t \]
    5. Applied rewrites85.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-59} \lor \neg \left(x \leq 1.4 \cdot 10^{-34}\right):\\ \;\;\;\;\left(1 - \left(y - z\right)\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 37.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -980000:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-163}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -980000.0)
   (* z x)
   (if (<= z -1.06e-163) (* y t) (if (<= z 6e-15) x (* z x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -980000.0) {
		tmp = z * x;
	} else if (z <= -1.06e-163) {
		tmp = y * t;
	} else if (z <= 6e-15) {
		tmp = x;
	} else {
		tmp = z * x;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (z <= (-980000.0d0)) then
        tmp = z * x
    else if (z <= (-1.06d-163)) then
        tmp = y * t
    else if (z <= 6d-15) then
        tmp = x
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -980000.0) {
		tmp = z * x;
	} else if (z <= -1.06e-163) {
		tmp = y * t;
	} else if (z <= 6e-15) {
		tmp = x;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -980000.0:
		tmp = z * x
	elif z <= -1.06e-163:
		tmp = y * t
	elif z <= 6e-15:
		tmp = x
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -980000.0)
		tmp = Float64(z * x);
	elseif (z <= -1.06e-163)
		tmp = Float64(y * t);
	elseif (z <= 6e-15)
		tmp = x;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -980000.0)
		tmp = z * x;
	elseif (z <= -1.06e-163)
		tmp = y * t;
	elseif (z <= 6e-15)
		tmp = x;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -980000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.06e-163], N[(y * t), $MachinePrecision], If[LessEqual[z, 6e-15], x, N[(z * x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -980000:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -1.06 \cdot 10^{-163}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 6 \cdot 10^{-15}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -9.8e5 or 6e-15 < z

    1. Initial program 99.9%

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

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

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

        \[\leadsto \left(-1 \cdot z\right) \cdot \color{blue}{\left(t - x\right)} \]
      3. mul-1-negN/A

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

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

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

      \[\leadsto \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
    6. Taylor expanded in x around inf

      \[\leadsto x \cdot \color{blue}{z} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto z \cdot x \]
      2. lower-*.f6441.2

        \[\leadsto z \cdot x \]
    8. Applied rewrites41.2%

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

    if -9.8e5 < z < -1.06000000000000006e-163

    1. Initial program 100.0%

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

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

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

        \[\leadsto \left(y - z\right) \cdot \color{blue}{t} \]
      3. lift--.f6451.5

        \[\leadsto \left(y - z\right) \cdot t \]
    5. Applied rewrites51.5%

      \[\leadsto \color{blue}{\left(y - z\right) \cdot t} \]
    6. Taylor expanded in y around inf

      \[\leadsto y \cdot t \]
    7. Step-by-step derivation
      1. Applied rewrites42.5%

        \[\leadsto y \cdot t \]

      if -1.06000000000000006e-163 < z < 6e-15

      1. Initial program 100.0%

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

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

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

          \[\leadsto \left(t - x\right) \cdot y + x \]
        3. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
        4. lift--.f6491.7

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

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

        \[\leadsto x \]
      7. Step-by-step derivation
        1. Applied rewrites41.5%

          \[\leadsto x \]
      8. Recombined 3 regimes into one program.
      9. Add Preprocessing

      Alternative 4: 84.4% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(-z, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= y -6.5e+15)
         (fma (- t x) y x)
         (if (<= y 1.3e-5) (fma (- z) (- t x) x) (* (- t x) y))))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if (y <= -6.5e+15) {
      		tmp = fma((t - x), y, x);
      	} else if (y <= 1.3e-5) {
      		tmp = fma(-z, (t - x), x);
      	} else {
      		tmp = (t - x) * y;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (y <= -6.5e+15)
      		tmp = fma(Float64(t - x), y, x);
      	elseif (y <= 1.3e-5)
      		tmp = fma(Float64(-z), Float64(t - x), x);
      	else
      		tmp = Float64(Float64(t - x) * y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e+15], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[y, 1.3e-5], N[((-z) * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -6.5 \cdot 10^{+15}:\\
      \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
      
      \mathbf{elif}\;y \leq 1.3 \cdot 10^{-5}:\\
      \;\;\;\;\mathsf{fma}\left(-z, t - x, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(t - x\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -6.5e15

        1. Initial program 99.9%

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

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

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

            \[\leadsto \left(t - x\right) \cdot y + x \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
          4. lift--.f6483.1

            \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
        5. Applied rewrites83.1%

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

        if -6.5e15 < y < 1.29999999999999992e-5

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(-1 \cdot z\right) \cdot \left(t - x\right) + x \]
          3. lower-fma.f64N/A

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

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

            \[\leadsto \mathsf{fma}\left(-z, \color{blue}{t} - x, x\right) \]
          6. lift--.f6491.5

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

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

        if 1.29999999999999992e-5 < y

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6485.6

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites85.6%

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

      Alternative 5: 83.4% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1700000 \lor \neg \left(z \leq 2.35 \cdot 10^{+54}\right):\\ \;\;\;\;\left(-z\right) \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= z -1700000.0) (not (<= z 2.35e+54)))
         (* (- z) (- t x))
         (fma (- t x) y x)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((z <= -1700000.0) || !(z <= 2.35e+54)) {
      		tmp = -z * (t - x);
      	} else {
      		tmp = fma((t - x), y, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((z <= -1700000.0) || !(z <= 2.35e+54))
      		tmp = Float64(Float64(-z) * Float64(t - x));
      	else
      		tmp = fma(Float64(t - x), y, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1700000.0], N[Not[LessEqual[z, 2.35e+54]], $MachinePrecision]], N[((-z) * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -1700000 \lor \neg \left(z \leq 2.35 \cdot 10^{+54}\right):\\
      \;\;\;\;\left(-z\right) \cdot \left(t - x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -1.7e6 or 2.34999999999999996e54 < z

        1. Initial program 99.9%

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

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

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

            \[\leadsto \left(-1 \cdot z\right) \cdot \color{blue}{\left(t - x\right)} \]
          3. mul-1-negN/A

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

            \[\leadsto \left(-z\right) \cdot \left(\color{blue}{t} - x\right) \]
          5. lift--.f6477.7

            \[\leadsto \left(-z\right) \cdot \left(t - \color{blue}{x}\right) \]
        5. Applied rewrites77.7%

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

        if -1.7e6 < z < 2.34999999999999996e54

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot y + x \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
          4. lift--.f6487.8

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

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

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

      Alternative 6: 68.2% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.024 \lor \neg \left(y \leq 1.3 \cdot 10^{-5}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= y -0.024) (not (<= y 1.3e-5))) (* (- t x) y) (fma z x x)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((y <= -0.024) || !(y <= 1.3e-5)) {
      		tmp = (t - x) * y;
      	} else {
      		tmp = fma(z, x, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((y <= -0.024) || !(y <= 1.3e-5))
      		tmp = Float64(Float64(t - x) * y);
      	else
      		tmp = fma(z, x, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.024], N[Not[LessEqual[y, 1.3e-5]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -0.024 \lor \neg \left(y \leq 1.3 \cdot 10^{-5}\right):\\
      \;\;\;\;\left(t - x\right) \cdot y\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -0.024 or 1.29999999999999992e-5 < y

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6482.0

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites82.0%

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

        if -0.024 < y < 1.29999999999999992e-5

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f648.8

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites8.8%

          \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
        6. Taylor expanded in t around 0

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

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

            \[\leadsto \left(-1 \cdot x\right) \cdot \left(y - z\right) + x \]
          3. mul-1-negN/A

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

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

            \[\leadsto \mathsf{fma}\left(-x, \color{blue}{y} - z, x\right) \]
          6. lift--.f6465.7

            \[\leadsto \mathsf{fma}\left(-x, y - \color{blue}{z}, x\right) \]
        8. Applied rewrites65.7%

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. *-commutativeN/A

            \[\leadsto z \cdot x + x \]
          3. lower-fma.f6465.7

            \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
        11. Applied rewrites65.7%

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x\right) \]
      3. Recombined 2 regimes into one program.
      4. Final simplification73.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.024 \lor \neg \left(y \leq 1.3 \cdot 10^{-5}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 7: 68.3% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.7 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= y -2.7e-5)
         (fma (- t x) y x)
         (if (<= y 1.3e-5) (fma z x x) (* (- t x) y))))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if (y <= -2.7e-5) {
      		tmp = fma((t - x), y, x);
      	} else if (y <= 1.3e-5) {
      		tmp = fma(z, x, x);
      	} else {
      		tmp = (t - x) * y;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (y <= -2.7e-5)
      		tmp = fma(Float64(t - x), y, x);
      	elseif (y <= 1.3e-5)
      		tmp = fma(z, x, x);
      	else
      		tmp = Float64(Float64(t - x) * y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[y, -2.7e-5], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[y, 1.3e-5], N[(z * x + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -2.7 \cdot 10^{-5}:\\
      \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
      
      \mathbf{elif}\;y \leq 1.3 \cdot 10^{-5}:\\
      \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(t - x\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -2.6999999999999999e-5

        1. Initial program 99.9%

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

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

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

            \[\leadsto \left(t - x\right) \cdot y + x \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
          4. lift--.f6480.6

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

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

        if -2.6999999999999999e-5 < y < 1.29999999999999992e-5

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f648.8

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites8.8%

          \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
        6. Taylor expanded in t around 0

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

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

            \[\leadsto \left(-1 \cdot x\right) \cdot \left(y - z\right) + x \]
          3. mul-1-negN/A

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

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

            \[\leadsto \mathsf{fma}\left(-x, \color{blue}{y} - z, x\right) \]
          6. lift--.f6465.7

            \[\leadsto \mathsf{fma}\left(-x, y - \color{blue}{z}, x\right) \]
        8. Applied rewrites65.7%

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. *-commutativeN/A

            \[\leadsto z \cdot x + x \]
          3. lower-fma.f6465.7

            \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
        11. Applied rewrites65.7%

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

        if 1.29999999999999992e-5 < y

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6485.6

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites85.6%

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

      Alternative 8: 49.9% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -900000000 \lor \neg \left(y \leq 1550000000\right):\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= y -900000000.0) (not (<= y 1550000000.0)))
         (* (- x) y)
         (fma z x x)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((y <= -900000000.0) || !(y <= 1550000000.0)) {
      		tmp = -x * y;
      	} else {
      		tmp = fma(z, x, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((y <= -900000000.0) || !(y <= 1550000000.0))
      		tmp = Float64(Float64(-x) * y);
      	else
      		tmp = fma(z, x, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[y, -900000000.0], N[Not[LessEqual[y, 1550000000.0]], $MachinePrecision]], N[((-x) * y), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -900000000 \lor \neg \left(y \leq 1550000000\right):\\
      \;\;\;\;\left(-x\right) \cdot y\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -9e8 or 1.55e9 < y

        1. Initial program 100.0%

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

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

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

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

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites83.4%

          \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
        6. Taylor expanded in x around inf

          \[\leadsto \left(-1 \cdot x\right) \cdot y \]
        7. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot y \]
          2. lower-neg.f6451.2

            \[\leadsto \left(-x\right) \cdot y \]
        8. Applied rewrites51.2%

          \[\leadsto \left(-x\right) \cdot y \]

        if -9e8 < y < 1.55e9

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6410.2

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites10.2%

          \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
        6. Taylor expanded in t around 0

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

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

            \[\leadsto \left(-1 \cdot x\right) \cdot \left(y - z\right) + x \]
          3. mul-1-negN/A

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

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

            \[\leadsto \mathsf{fma}\left(-x, \color{blue}{y} - z, x\right) \]
          6. lift--.f6465.5

            \[\leadsto \mathsf{fma}\left(-x, y - \color{blue}{z}, x\right) \]
        8. Applied rewrites65.5%

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. *-commutativeN/A

            \[\leadsto z \cdot x + x \]
          3. lower-fma.f6464.9

            \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
        11. Applied rewrites64.9%

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x\right) \]
      3. Recombined 2 regimes into one program.
      4. Final simplification58.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -900000000 \lor \neg \left(y \leq 1550000000\right):\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 49.8% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-56} \lor \neg \left(x \leq 380000000000\right):\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (or (<= x -1.95e-56) (not (<= x 380000000000.0)))
         (fma z x x)
         (fma t y x)))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if ((x <= -1.95e-56) || !(x <= 380000000000.0)) {
      		tmp = fma(z, x, x);
      	} else {
      		tmp = fma(t, y, x);
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if ((x <= -1.95e-56) || !(x <= 380000000000.0))
      		tmp = fma(z, x, x);
      	else
      		tmp = fma(t, y, x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.95e-56], N[Not[LessEqual[x, 380000000000.0]], $MachinePrecision]], N[(z * x + x), $MachinePrecision], N[(t * y + x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -1.95 \cdot 10^{-56} \lor \neg \left(x \leq 380000000000\right):\\
      \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < -1.95e-56 or 3.8e11 < x

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6441.9

            \[\leadsto \left(t - x\right) \cdot y \]
        5. Applied rewrites41.9%

          \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
        6. Taylor expanded in t around 0

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

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

            \[\leadsto \left(-1 \cdot x\right) \cdot \left(y - z\right) + x \]
          3. mul-1-negN/A

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

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

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

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

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        10. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. *-commutativeN/A

            \[\leadsto z \cdot x + x \]
          3. lower-fma.f6456.6

            \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
        11. Applied rewrites56.6%

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

        if -1.95e-56 < x < 3.8e11

        1. Initial program 100.0%

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

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

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

            \[\leadsto \left(t - x\right) \cdot y + x \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
          4. lift--.f6457.7

            \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
        5. Applied rewrites57.7%

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

          \[\leadsto \mathsf{fma}\left(t, y, x\right) \]
        7. Step-by-step derivation
          1. Applied rewrites47.8%

            \[\leadsto \mathsf{fma}\left(t, y, x\right) \]
        8. Recombined 2 regimes into one program.
        9. Final simplification53.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{-56} \lor \neg \left(x \leq 380000000000\right):\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \end{array} \]
        10. Add Preprocessing

        Alternative 10: 49.6% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+65} \lor \neg \left(y \leq 16000\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (if (or (<= y -1.8e+65) (not (<= y 16000.0))) (* y t) (fma z x x)))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if ((y <= -1.8e+65) || !(y <= 16000.0)) {
        		tmp = y * t;
        	} else {
        		tmp = fma(z, x, x);
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	tmp = 0.0
        	if ((y <= -1.8e+65) || !(y <= 16000.0))
        		tmp = Float64(y * t);
        	else
        		tmp = fma(z, x, x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e+65], N[Not[LessEqual[y, 16000.0]], $MachinePrecision]], N[(y * t), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -1.8 \cdot 10^{+65} \lor \neg \left(y \leq 16000\right):\\
        \;\;\;\;y \cdot t\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -1.79999999999999989e65 or 16000 < y

          1. Initial program 100.0%

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

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

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

              \[\leadsto \left(y - z\right) \cdot \color{blue}{t} \]
            3. lift--.f6450.5

              \[\leadsto \left(y - z\right) \cdot t \]
          5. Applied rewrites50.5%

            \[\leadsto \color{blue}{\left(y - z\right) \cdot t} \]
          6. Taylor expanded in y around inf

            \[\leadsto y \cdot t \]
          7. Step-by-step derivation
            1. Applied rewrites39.4%

              \[\leadsto y \cdot t \]

            if -1.79999999999999989e65 < y < 16000

            1. Initial program 100.0%

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

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

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

                \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
              3. lift--.f6414.8

                \[\leadsto \left(t - x\right) \cdot y \]
            5. Applied rewrites14.8%

              \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
            6. Taylor expanded in t around 0

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

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

                \[\leadsto \left(-1 \cdot x\right) \cdot \left(y - z\right) + x \]
              3. mul-1-negN/A

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

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

                \[\leadsto \mathsf{fma}\left(-x, \color{blue}{y} - z, x\right) \]
              6. lift--.f6465.2

                \[\leadsto \mathsf{fma}\left(-x, y - \color{blue}{z}, x\right) \]
            8. Applied rewrites65.2%

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

              \[\leadsto x + \color{blue}{x \cdot z} \]
            10. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto x \cdot z + x \]
              2. *-commutativeN/A

                \[\leadsto z \cdot x + x \]
              3. lower-fma.f6460.9

                \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
            11. Applied rewrites60.9%

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{x}, x\right) \]
          8. Recombined 2 regimes into one program.
          9. Final simplification51.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+65} \lor \neg \left(y \leq 16000\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \]
          10. Add Preprocessing

          Alternative 11: 36.3% accurate, 0.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 6 \cdot 10^{-15}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (or (<= z -1.0) (not (<= z 6e-15))) (* z x) x))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -1.0) || !(z <= 6e-15)) {
          		tmp = z * x;
          	} else {
          		tmp = x;
          	}
          	return tmp;
          }
          
          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
              real(8) :: tmp
              if ((z <= (-1.0d0)) .or. (.not. (z <= 6d-15))) then
                  tmp = z * x
              else
                  tmp = x
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -1.0) || !(z <= 6e-15)) {
          		tmp = z * x;
          	} else {
          		tmp = x;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	tmp = 0
          	if (z <= -1.0) or not (z <= 6e-15):
          		tmp = z * x
          	else:
          		tmp = x
          	return tmp
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((z <= -1.0) || !(z <= 6e-15))
          		tmp = Float64(z * x);
          	else
          		tmp = x;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((z <= -1.0) || ~((z <= 6e-15)))
          		tmp = z * x;
          	else
          		tmp = x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 6e-15]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 6 \cdot 10^{-15}\right):\\
          \;\;\;\;z \cdot x\\
          
          \mathbf{else}:\\
          \;\;\;\;x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1 or 6e-15 < z

            1. Initial program 99.9%

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

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

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

                \[\leadsto \left(-1 \cdot z\right) \cdot \color{blue}{\left(t - x\right)} \]
              3. mul-1-negN/A

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

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

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

              \[\leadsto \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
            6. Taylor expanded in x around inf

              \[\leadsto x \cdot \color{blue}{z} \]
            7. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto z \cdot x \]
              2. lower-*.f6441.2

                \[\leadsto z \cdot x \]
            8. Applied rewrites41.2%

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

            if -1 < z < 6e-15

            1. Initial program 100.0%

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

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

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

                \[\leadsto \left(t - x\right) \cdot y + x \]
              3. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
              4. lift--.f6491.5

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

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

              \[\leadsto x \]
            7. Step-by-step derivation
              1. Applied rewrites35.2%

                \[\leadsto x \]
            8. Recombined 2 regimes into one program.
            9. Final simplification38.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 6 \cdot 10^{-15}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
            10. Add Preprocessing

            Alternative 12: 17.3% accurate, 15.0× speedup?

            \[\begin{array}{l} \\ x \end{array} \]
            (FPCore (x y z t) :precision binary64 x)
            double code(double x, double y, double z, double t) {
            	return x;
            }
            
            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
            end function
            
            public static double code(double x, double y, double z, double t) {
            	return x;
            }
            
            def code(x, y, z, t):
            	return x
            
            function code(x, y, z, t)
            	return x
            end
            
            function tmp = code(x, y, z, t)
            	tmp = x;
            end
            
            code[x_, y_, z_, t_] := x
            
            \begin{array}{l}
            
            \\
            x
            \end{array}
            
            Derivation
            1. Initial program 100.0%

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

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

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

                \[\leadsto \left(t - x\right) \cdot y + x \]
              3. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
              4. lift--.f6460.5

                \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
            5. Applied rewrites60.5%

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

              \[\leadsto x \]
            7. Step-by-step derivation
              1. Applied rewrites17.6%

                \[\leadsto x \]
              2. Add Preprocessing

              Developer Target 1: 96.1% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right) \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
              double code(double x, double y, double z, double t) {
              	return x + ((t * (y - z)) + (-x * (y - z)));
              }
              
              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 + ((t * (y - z)) + (-x * (y - z)))
              end function
              
              public static double code(double x, double y, double z, double t) {
              	return x + ((t * (y - z)) + (-x * (y - z)));
              }
              
              def code(x, y, z, t):
              	return x + ((t * (y - z)) + (-x * (y - z)))
              
              function code(x, y, z, t)
              	return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z))))
              end
              
              function tmp = code(x, y, z, t)
              	tmp = x + ((t * (y - z)) + (-x * (y - z)));
              end
              
              code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
              \end{array}
              

              Reproduce

              ?
              herbie shell --seed 2025064 
              (FPCore (x y z t)
                :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
                :precision binary64
              
                :alt
                (! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
              
                (+ x (* (- y z) (- t x))))