Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A

Percentage Accurate: 99.9% → 99.9%
Time: 5.4s
Alternatives: 13
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, a, b)
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), intent (in) :: a
    real(8), intent (in) :: b
    code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\[\begin{array}{l} \\ \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))
double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
}
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, a, b)
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), intent (in) :: a
    real(8), intent (in) :: b
    code = (((x + y) + z) - (z * log(t))) + ((a - 0.5d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return (((x + y) + z) - (z * Math.log(t))) + ((a - 0.5) * b);
}
def code(x, y, z, t, a, b):
	return (((x + y) + z) - (z * math.log(t))) + ((a - 0.5) * b)
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) + Float64(Float64(a - 0.5) * b))
end
function tmp = code(x, y, z, t, a, b)
	tmp = (((x + y) + z) - (z * log(t))) + ((a - 0.5) * b);
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right) \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (fma (- a 0.5) b (+ (fma (- 1.0 (log t)) z y) x)))
double code(double x, double y, double z, double t, double a, double b) {
	return fma((a - 0.5), b, (fma((1.0 - log(t)), z, y) + x));
}
function code(x, y, z, t, a, b)
	return fma(Float64(a - 0.5), b, Float64(fma(Float64(1.0 - log(t)), z, y) + x))
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
  3. Add Preprocessing

Alternative 2: 89.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 1 - \log t\\ \mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -2 \cdot 10^{-76}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(t\_1, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, z, y\right) + \left(a - 0.5\right) \cdot b\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- 1.0 (log t))))
   (if (<= (- (+ (+ x y) z) (* z (log t))) -2e-76)
     (fma (- a 0.5) b (fma t_1 z x))
     (+ (fma t_1 z y) (* (- a 0.5) b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = 1.0 - log(t);
	double tmp;
	if ((((x + y) + z) - (z * log(t))) <= -2e-76) {
		tmp = fma((a - 0.5), b, fma(t_1, z, x));
	} else {
		tmp = fma(t_1, z, y) + ((a - 0.5) * b);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(1.0 - log(t))
	tmp = 0.0
	if (Float64(Float64(Float64(x + y) + z) - Float64(z * log(t))) <= -2e-76)
		tmp = fma(Float64(a - 0.5), b, fma(t_1, z, x));
	else
		tmp = Float64(fma(t_1, z, y) + Float64(Float64(a - 0.5) * b));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision] - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-76], N[(N[(a - 0.5), $MachinePrecision] * b + N[(t$95$1 * z + x), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * z + y), $MachinePrecision] + N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;\left(\left(x + y\right) + z\right) - z \cdot \log t \leq -2 \cdot 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(t\_1, z, x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, z, y\right) + \left(a - 0.5\right) \cdot b\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) < -1.99999999999999985e-76

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in y around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + z \cdot \left(1 - \log t\right)}\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \left(1 - \log t\right) + \color{blue}{x}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \left(1 - \log t\right) \cdot z + x\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, \color{blue}{z}, x\right)\right) \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
      5. lift--.f6479.3

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
    5. Applied rewrites79.3%

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, \color{blue}{\mathsf{fma}\left(1 - \log t, z, x\right)}\right) \]

    if -1.99999999999999985e-76 < (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t)))

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\left(\left(y + z\right) - z \cdot \log t\right)} + \left(a - \frac{1}{2}\right) \cdot b \]
    3. Step-by-step derivation
      1. associate--l+N/A

        \[\leadsto \left(y + \color{blue}{\left(z - z \cdot \log t\right)}\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      2. sub-flipN/A

        \[\leadsto \left(y + \left(z + \color{blue}{\left(\mathsf{neg}\left(z \cdot \log t\right)\right)}\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      3. *-rgt-identityN/A

        \[\leadsto \left(y + \left(z \cdot 1 + \left(\mathsf{neg}\left(\color{blue}{z \cdot \log t}\right)\right)\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      4. distribute-rgt-neg-outN/A

        \[\leadsto \left(y + \left(z \cdot 1 + z \cdot \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      5. mul-1-negN/A

        \[\leadsto \left(y + \left(z \cdot 1 + z \cdot \left(-1 \cdot \color{blue}{\log t}\right)\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      6. distribute-lft-outN/A

        \[\leadsto \left(y + z \cdot \color{blue}{\left(1 + -1 \cdot \log t\right)}\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      7. mul-1-negN/A

        \[\leadsto \left(y + z \cdot \left(1 + \left(\mathsf{neg}\left(\log t\right)\right)\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      8. sub-flipN/A

        \[\leadsto \left(y + z \cdot \left(1 - \color{blue}{\log t}\right)\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      9. +-commutativeN/A

        \[\leadsto \left(z \cdot \left(1 - \log t\right) + \color{blue}{y}\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(1 - \log t\right) \cdot z + y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      11. sub-flipN/A

        \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(\log t\right)\right)\right) \cdot z + y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      12. mul-1-negN/A

        \[\leadsto \left(\left(1 + -1 \cdot \log t\right) \cdot z + y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      13. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(1 + -1 \cdot \log t, \color{blue}{z}, y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      14. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(1 + \left(\mathsf{neg}\left(\log t\right)\right), z, y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      15. sub-flipN/A

        \[\leadsto \mathsf{fma}\left(1 - \log t, z, y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      16. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(1 - \log t, z, y\right) + \left(a - \frac{1}{2}\right) \cdot b \]
      17. lift-log.f6478.0

        \[\leadsto \mathsf{fma}\left(1 - \log t, z, y\right) + \left(a - 0.5\right) \cdot b \]
    4. Applied rewrites78.0%

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

Alternative 3: 88.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq 10^{+63}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (+ x y) 1e+63)
   (fma (- a 0.5) b (fma (- 1.0 (log t)) z x))
   (+ (fma (- a 0.5) b y) x)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((x + y) <= 1e+63) {
		tmp = fma((a - 0.5), b, fma((1.0 - log(t)), z, x));
	} else {
		tmp = fma((a - 0.5), b, y) + x;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(x + y) <= 1e+63)
		tmp = fma(Float64(a - 0.5), b, fma(Float64(1.0 - log(t)), z, x));
	else
		tmp = Float64(fma(Float64(a - 0.5), b, y) + x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], 1e+63], N[(N[(a - 0.5), $MachinePrecision] * b + N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < 1.00000000000000006e63

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in y around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + z \cdot \left(1 - \log t\right)}\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \left(1 - \log t\right) + \color{blue}{x}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \left(1 - \log t\right) \cdot z + x\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, \color{blue}{z}, x\right)\right) \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
      5. lift--.f6479.3

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
    5. Applied rewrites79.3%

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, \color{blue}{\mathsf{fma}\left(1 - \log t, z, x\right)}\right) \]

    if 1.00000000000000006e63 < (+.f64 x y)

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a - \frac{1}{2}\right)\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \left(y + b \cdot \left(a - \frac{1}{2}\right)\right) + \color{blue}{x} \]
      3. +-commutativeN/A

        \[\leadsto \left(b \cdot \left(a - \frac{1}{2}\right) + y\right) + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(a - \frac{1}{2}\right) \cdot b + y\right) + x \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
      6. lift--.f6479.0

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
    4. Applied rewrites79.0%

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

Alternative 4: 84.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(a - 0.5, b, z \cdot \left(1 - \log t\right)\right)\\ \mathbf{if}\;z \leq -1.5 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+179}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (fma (- a 0.5) b (* z (- 1.0 (log t))))))
   (if (<= z -1.5e+135) t_1 (if (<= z 6e+179) (fma (- a 0.5) b (+ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = fma((a - 0.5), b, (z * (1.0 - log(t))));
	double tmp;
	if (z <= -1.5e+135) {
		tmp = t_1;
	} else if (z <= 6e+179) {
		tmp = fma((a - 0.5), b, (x + y));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = fma(Float64(a - 0.5), b, Float64(z * Float64(1.0 - log(t))))
	tmp = 0.0
	if (z <= -1.5e+135)
		tmp = t_1;
	elseif (z <= 6e+179)
		tmp = fma(Float64(a - 0.5), b, Float64(x + y));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e+135], t$95$1, If[LessEqual[z, 6e+179], N[(N[(a - 0.5), $MachinePrecision] * b + N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a - 0.5, b, z \cdot \left(1 - \log t\right)\right)\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+179}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.5e135 or 5.9999999999999996e179 < z

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in y around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + z \cdot \left(1 - \log t\right)}\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \left(1 - \log t\right) + \color{blue}{x}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \left(1 - \log t\right) \cdot z + x\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, \color{blue}{z}, x\right)\right) \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
      5. lift--.f6479.3

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, x\right)\right) \]
    5. Applied rewrites79.3%

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, \color{blue}{\mathsf{fma}\left(1 - \log t, z, x\right)}\right) \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \color{blue}{\left(1 - \log t\right)}\right) \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \left(1 - \color{blue}{\log t}\right)\right) \]
      2. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, z \cdot \left(1 - \log t\right)\right) \]
      3. lift--.f6458.0

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, z \cdot \left(1 - \log t\right)\right) \]
    8. Applied rewrites58.0%

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, z \cdot \color{blue}{\left(1 - \log t\right)}\right) \]

    if -1.5e135 < z < 5.9999999999999996e179

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
    4. Step-by-step derivation
      1. lower-+.f6479.1

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
    5. Applied rewrites79.1%

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

Alternative 5: 81.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;t\_1 \leq -2000000000:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+58}:\\ \;\;\;\;\left(\left(z + y\right) + x\right) - \log t \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- a 0.5) b)))
   (if (<= t_1 -2000000000.0)
     (+ (fma (- a 0.5) b y) x)
     (if (<= t_1 5e+58)
       (- (+ (+ z y) x) (* (log t) z))
       (fma (- a 0.5) b (+ x y))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (a - 0.5) * b;
	double tmp;
	if (t_1 <= -2000000000.0) {
		tmp = fma((a - 0.5), b, y) + x;
	} else if (t_1 <= 5e+58) {
		tmp = ((z + y) + x) - (log(t) * z);
	} else {
		tmp = fma((a - 0.5), b, (x + y));
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(a - 0.5) * b)
	tmp = 0.0
	if (t_1 <= -2000000000.0)
		tmp = Float64(fma(Float64(a - 0.5), b, y) + x);
	elseif (t_1 <= 5e+58)
		tmp = Float64(Float64(Float64(z + y) + x) - Float64(log(t) * z));
	else
		tmp = fma(Float64(a - 0.5), b, Float64(x + y));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000000.0], N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+58], N[(N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(a - 0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2000000000:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right) + x\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+58}:\\
\;\;\;\;\left(\left(z + y\right) + x\right) - \log t \cdot z\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -2e9

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a - \frac{1}{2}\right)\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \left(y + b \cdot \left(a - \frac{1}{2}\right)\right) + \color{blue}{x} \]
      3. +-commutativeN/A

        \[\leadsto \left(b \cdot \left(a - \frac{1}{2}\right) + y\right) + x \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(a - \frac{1}{2}\right) \cdot b + y\right) + x \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
      6. lift--.f6479.0

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
    4. Applied rewrites79.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]

    if -2e9 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.99999999999999986e58

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in a around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\color{blue}{-1 \cdot b} + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right) \]
      5. +-commutativeN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \color{blue}{-1 \cdot b}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \left(\mathsf{neg}\left(b\right)\right)\right) \]
      7. sub-flip-reverseN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
      8. lower--.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
    4. Applied rewrites72.5%

      \[\leadsto \color{blue}{\left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(-0.5, b, z\right) + y\right) + x\right)}{a} - b\right)} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      2. lift--.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      3. lift-*.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      4. lift-log.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      5. lift-+.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      6. lift-+.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
      7. lift-fma.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)}{a} - b\right) \]
      8. mult-flipN/A

        \[\leadsto \left(-a\right) \cdot \left(\left(\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)\right) \cdot \frac{1}{a} - b\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\left(\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)\right) \cdot \frac{1}{a} - b\right) \]
    6. Applied rewrites72.4%

      \[\leadsto \left(-a\right) \cdot \left(\left(\left(\left(\log t \cdot z - y\right) - \mathsf{fma}\left(-0.5, b, z\right)\right) - x\right) \cdot \frac{1}{a} - b\right) \]
    7. Taylor expanded in b around 0

      \[\leadsto \color{blue}{\left(x + \left(y + z\right)\right) - z \cdot \log t} \]
    8. Step-by-step derivation
      1. lower--.f64N/A

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

        \[\leadsto \left(\left(y + z\right) + x\right) - \color{blue}{z} \cdot \log t \]
      3. lower-+.f64N/A

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

        \[\leadsto \left(\left(z + y\right) + x\right) - z \cdot \log t \]
      5. lower-+.f64N/A

        \[\leadsto \left(\left(z + y\right) + x\right) - z \cdot \log t \]
      6. *-commutativeN/A

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

        \[\leadsto \left(\left(z + y\right) + x\right) - \log t \cdot z \]
      8. lift-*.f6463.0

        \[\leadsto \left(\left(z + y\right) + x\right) - \log t \cdot \color{blue}{z} \]
    9. Applied rewrites63.0%

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

    if 4.99999999999999986e58 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
    4. Step-by-step derivation
      1. lower-+.f6479.1

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
    5. Applied rewrites79.1%

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

Alternative 6: 79.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq 5.8 \cdot 10^{+212}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \log t\right) \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z 5.8e+212) (fma (- a 0.5) b (+ x y)) (* (- 1.0 (log t)) z)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= 5.8e+212) {
		tmp = fma((a - 0.5), b, (x + y));
	} else {
		tmp = (1.0 - log(t)) * z;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (z <= 5.8e+212)
		tmp = fma(Float64(a - 0.5), b, Float64(x + y));
	else
		tmp = Float64(Float64(1.0 - log(t)) * z);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 5.8e+212], N[(N[(a - 0.5), $MachinePrecision] * b + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.8 \cdot 10^{+212}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, x + y\right)\\

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


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

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
    4. Step-by-step derivation
      1. lower-+.f6479.1

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
    5. Applied rewrites79.1%

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, \color{blue}{x + y}\right) \]

    if 5.7999999999999997e212 < z

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in a around inf

      \[\leadsto \color{blue}{a \cdot b} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto b \cdot \color{blue}{a} \]
      2. lower-*.f6426.4

        \[\leadsto b \cdot \color{blue}{a} \]
    4. Applied rewrites26.4%

      \[\leadsto \color{blue}{b \cdot a} \]
    5. Taylor expanded in z around -inf

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

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

        \[\leadsto \left(1 + \left(\mathsf{neg}\left(\log t\right)\right)\right) \cdot z \]
      3. sub-flipN/A

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

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

        \[\leadsto \left(1 - \log t\right) \cdot z \]
      6. lift--.f6422.0

        \[\leadsto \left(1 - \log t\right) \cdot z \]
    7. Applied rewrites22.0%

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

Alternative 7: 79.0% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a - 0.5, b, x + y\right) \end{array} \]
(FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
	return fma((a - 0.5), b, (x + y));
}
function code(x, y, z, t, a, b)
	return fma(Float64(a - 0.5), b, Float64(x + y))
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(a - 0.5, b, x + y\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
  3. Taylor expanded in z around 0

    \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
  4. Step-by-step derivation
    1. lower-+.f6479.1

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
  5. Applied rewrites79.1%

    \[\leadsto \mathsf{fma}\left(a - 0.5, b, \color{blue}{x + y}\right) \]
  6. Add Preprocessing

Alternative 8: 78.9% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a - 0.5, b, y\right) + x \end{array} \]
(FPCore (x y z t a b) :precision binary64 (+ (fma (- a 0.5) b y) x))
double code(double x, double y, double z, double t, double a, double b) {
	return fma((a - 0.5), b, y) + x;
}
function code(x, y, z, t, a, b)
	return Float64(fma(Float64(a - 0.5), b, y) + x)
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(a - 0.5, b, y\right) + x
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Taylor expanded in z around 0

    \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a - \frac{1}{2}\right)\right)} \]
  3. Step-by-step derivation
    1. +-commutativeN/A

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

      \[\leadsto \left(y + b \cdot \left(a - \frac{1}{2}\right)\right) + \color{blue}{x} \]
    3. +-commutativeN/A

      \[\leadsto \left(b \cdot \left(a - \frac{1}{2}\right) + y\right) + x \]
    4. *-commutativeN/A

      \[\leadsto \left(\left(a - \frac{1}{2}\right) \cdot b + y\right) + x \]
    5. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) + x \]
    6. lift--.f6479.0

      \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) + x \]
  4. Applied rewrites79.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, y\right) + x} \]
  5. Add Preprocessing

Alternative 9: 57.8% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{+74}:\\ \;\;\;\;\left(-a\right) \cdot \frac{-x}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (+ x y) -1e+74) (* (- a) (/ (- x) a)) (fma (- a 0.5) b y)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((x + y) <= -1e+74) {
		tmp = -a * (-x / a);
	} else {
		tmp = fma((a - 0.5), b, y);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(x + y) <= -1e+74)
		tmp = Float64(Float64(-a) * Float64(Float64(-x) / a));
	else
		tmp = fma(Float64(a - 0.5), b, y);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e+74], N[((-a) * N[((-x) / a), $MachinePrecision]), $MachinePrecision], N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{+74}:\\
\;\;\;\;\left(-a\right) \cdot \frac{-x}{a}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a - 0.5, b, y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x y) < -9.99999999999999952e73

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Taylor expanded in a around -inf

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right) \]
      2. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
      4. lower-neg.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(\color{blue}{-1 \cdot b} + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right) \]
      5. +-commutativeN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \color{blue}{-1 \cdot b}\right) \]
      6. mul-1-negN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \left(\mathsf{neg}\left(b\right)\right)\right) \]
      7. sub-flip-reverseN/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
      8. lower--.f64N/A

        \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
    4. Applied rewrites72.5%

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

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

        \[\leadsto \left(-a\right) \cdot \frac{-1 \cdot x}{a} \]
      2. mul-1-negN/A

        \[\leadsto \left(-a\right) \cdot \frac{\mathsf{neg}\left(x\right)}{a} \]
      3. lower-/.f64N/A

        \[\leadsto \left(-a\right) \cdot \frac{\mathsf{neg}\left(x\right)}{a} \]
      4. lower-neg.f6416.0

        \[\leadsto \left(-a\right) \cdot \frac{-x}{a} \]
    7. Applied rewrites16.0%

      \[\leadsto \left(-a\right) \cdot \frac{-x}{\color{blue}{a}} \]

    if -9.99999999999999952e73 < (+.f64 x y)

    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
    4. Step-by-step derivation
      1. lower-+.f6479.1

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
    5. Applied rewrites79.1%

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

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) \]
    7. Step-by-step derivation
      1. Applied rewrites57.8%

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 10: 50.0% accurate, 3.0× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(a - 0.5, b, y\right) \end{array} \]
    (FPCore (x y z t a b) :precision binary64 (fma (- a 0.5) b y))
    double code(double x, double y, double z, double t, double a, double b) {
    	return fma((a - 0.5), b, y);
    }
    
    function code(x, y, z, t, a, b)
    	return fma(Float64(a - 0.5), b, y)
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(N[(a - 0.5), $MachinePrecision] * b + y), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(a - 0.5, b, y\right)
    \end{array}
    
    Derivation
    1. Initial program 99.9%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
    3. Taylor expanded in z around 0

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
    4. Step-by-step derivation
      1. lower-+.f6479.1

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
    5. Applied rewrites79.1%

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

      \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) \]
    7. Step-by-step derivation
      1. Applied rewrites57.8%

        \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) \]
      2. Add Preprocessing

      Alternative 11: 49.3% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;t\_1 \leq -10:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+180}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, b, y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
      (FPCore (x y z t a b)
       :precision binary64
       (let* ((t_1 (* (- a 0.5) b)) (t_2 (* b (- a 0.5))))
         (if (<= t_1 -10.0) t_2 (if (<= t_1 2e+180) (fma -0.5 b y) t_2))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double t_1 = (a - 0.5) * b;
      	double t_2 = b * (a - 0.5);
      	double tmp;
      	if (t_1 <= -10.0) {
      		tmp = t_2;
      	} else if (t_1 <= 2e+180) {
      		tmp = fma(-0.5, b, y);
      	} else {
      		tmp = t_2;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	t_1 = Float64(Float64(a - 0.5) * b)
      	t_2 = Float64(b * Float64(a - 0.5))
      	tmp = 0.0
      	if (t_1 <= -10.0)
      		tmp = t_2;
      	elseif (t_1 <= 2e+180)
      		tmp = fma(-0.5, b, y);
      	else
      		tmp = t_2;
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - 0.5), $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10.0], t$95$2, If[LessEqual[t$95$1, 2e+180], N[(-0.5 * b + y), $MachinePrecision], t$95$2]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(a - 0.5\right) \cdot b\\
      t_2 := b \cdot \left(a - 0.5\right)\\
      \mathbf{if}\;t\_1 \leq -10:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+180}:\\
      \;\;\;\;\mathsf{fma}\left(-0.5, b, y\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_2\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -10 or 2e180 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

        1. Initial program 99.9%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Taylor expanded in a around -inf

          \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right)} \]
        3. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{neg}\left(a \cdot \left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)\right) \]
          2. distribute-lft-neg-inN/A

            \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \left(\mathsf{neg}\left(a\right)\right) \cdot \color{blue}{\left(-1 \cdot b + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right)} \]
          4. lower-neg.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\color{blue}{-1 \cdot b} + -1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a}\right) \]
          5. +-commutativeN/A

            \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \color{blue}{-1 \cdot b}\right) \]
          6. mul-1-negN/A

            \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} + \left(\mathsf{neg}\left(b\right)\right)\right) \]
          7. sub-flip-reverseN/A

            \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
          8. lower--.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(-1 \cdot \frac{\left(x + \left(y + \left(z + \frac{-1}{2} \cdot b\right)\right)\right) - z \cdot \log t}{a} - \color{blue}{b}\right) \]
        4. Applied rewrites72.5%

          \[\leadsto \color{blue}{\left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(-0.5, b, z\right) + y\right) + x\right)}{a} - b\right)} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          2. lift--.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          3. lift-*.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          4. lift-log.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          5. lift-+.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          6. lift-+.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\mathsf{fma}\left(\frac{-1}{2}, b, z\right) + y\right) + x\right)}{a} - b\right) \]
          7. lift-fma.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\frac{\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)}{a} - b\right) \]
          8. mult-flipN/A

            \[\leadsto \left(-a\right) \cdot \left(\left(\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)\right) \cdot \frac{1}{a} - b\right) \]
          9. lower-*.f64N/A

            \[\leadsto \left(-a\right) \cdot \left(\left(\log t \cdot z - \left(\left(\left(\frac{-1}{2} \cdot b + z\right) + y\right) + x\right)\right) \cdot \frac{1}{a} - b\right) \]
        6. Applied rewrites72.4%

          \[\leadsto \left(-a\right) \cdot \left(\left(\left(\left(\log t \cdot z - y\right) - \mathsf{fma}\left(-0.5, b, z\right)\right) - x\right) \cdot \frac{1}{a} - b\right) \]
        7. Taylor expanded in b around inf

          \[\leadsto \color{blue}{b \cdot \left(a - \frac{1}{2}\right)} \]
        8. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto b \cdot \color{blue}{\left(a - \frac{1}{2}\right)} \]
          2. lift--.f6438.0

            \[\leadsto b \cdot \left(a - \color{blue}{0.5}\right) \]
        9. Applied rewrites38.0%

          \[\leadsto \color{blue}{b \cdot \left(a - 0.5\right)} \]

        if -10 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2e180

        1. Initial program 99.9%

          \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
        2. Applied rewrites99.9%

          \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
        3. Taylor expanded in z around 0

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
        4. Step-by-step derivation
          1. lower-+.f6479.1

            \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
        5. Applied rewrites79.1%

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

          \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) \]
        7. Step-by-step derivation
          1. Applied rewrites57.8%

            \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) \]
          2. Taylor expanded in a around 0

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, b, y\right) \]
          3. Step-by-step derivation
            1. Applied rewrites33.4%

              \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, b, y\right) \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 12: 46.8% accurate, 1.9× speedup?

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

            1. Initial program 99.9%

              \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
            2. Taylor expanded in a around inf

              \[\leadsto \color{blue}{a \cdot b} \]
            3. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto b \cdot \color{blue}{a} \]
              2. lower-*.f6426.4

                \[\leadsto b \cdot \color{blue}{a} \]
            4. Applied rewrites26.4%

              \[\leadsto \color{blue}{b \cdot a} \]

            if -2.9999999999999998e50 < a < 2.7e52

            1. Initial program 99.9%

              \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
            2. Applied rewrites99.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(a - 0.5, b, \mathsf{fma}\left(1 - \log t, z, y\right) + x\right)} \]
            3. Taylor expanded in z around 0

              \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, \color{blue}{x + y}\right) \]
            4. Step-by-step derivation
              1. lower-+.f6479.1

                \[\leadsto \mathsf{fma}\left(a - 0.5, b, x + \color{blue}{y}\right) \]
            5. Applied rewrites79.1%

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

              \[\leadsto \mathsf{fma}\left(a - \frac{1}{2}, b, y\right) \]
            7. Step-by-step derivation
              1. Applied rewrites57.8%

                \[\leadsto \mathsf{fma}\left(a - 0.5, b, y\right) \]
              2. Taylor expanded in a around 0

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{2}}, b, y\right) \]
              3. Step-by-step derivation
                1. Applied rewrites33.4%

                  \[\leadsto \mathsf{fma}\left(\color{blue}{-0.5}, b, y\right) \]
              4. Recombined 2 regimes into one program.
              5. Add Preprocessing

              Alternative 13: 26.4% accurate, 6.6× speedup?

              \[\begin{array}{l} \\ b \cdot a \end{array} \]
              (FPCore (x y z t a b) :precision binary64 (* b a))
              double code(double x, double y, double z, double t, double a, double b) {
              	return b * a;
              }
              
              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, a, b)
              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), intent (in) :: a
                  real(8), intent (in) :: b
                  code = b * a
              end function
              
              public static double code(double x, double y, double z, double t, double a, double b) {
              	return b * a;
              }
              
              def code(x, y, z, t, a, b):
              	return b * a
              
              function code(x, y, z, t, a, b)
              	return Float64(b * a)
              end
              
              function tmp = code(x, y, z, t, a, b)
              	tmp = b * a;
              end
              
              code[x_, y_, z_, t_, a_, b_] := N[(b * a), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              b \cdot a
              \end{array}
              
              Derivation
              1. Initial program 99.9%

                \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
              2. Taylor expanded in a around inf

                \[\leadsto \color{blue}{a \cdot b} \]
              3. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto b \cdot \color{blue}{a} \]
                2. lower-*.f6426.4

                  \[\leadsto b \cdot \color{blue}{a} \]
              4. Applied rewrites26.4%

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

              Reproduce

              ?
              herbie shell --seed 2025136 
              (FPCore (x y z t a b)
                :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
                :precision binary64
                (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))