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

Percentage Accurate: 99.9% → 99.9%
Time: 13.1s
Alternatives: 17
Speedup: 1.0×

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);
}
real(8) function code(x, y, z, t, a, b)
    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}

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 17 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);
}
real(8) function code(x, y, z, t, a, b)
    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.0× speedup?

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

\\
\mathsf{fma}\left(a + -0.5, b, \mathsf{fma}\left(\log t, -z, x + \left(z + y\right)\right)\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. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(a - \frac{1}{2}\right) \cdot b} + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) \]
    10. lower-fma.f6499.9

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, b, \left(\left(x + y\right) + z\right) - z \cdot \log t\right) \]
    14. metadata-eval99.9

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(a + \frac{-1}{2}, b, \color{blue}{\mathsf{fma}\left(\log t, \mathsf{neg}\left(z\right), \left(x + y\right) + z\right)}\right) \]
    22. lower-neg.f6499.9

      \[\leadsto \mathsf{fma}\left(a + -0.5, b, \mathsf{fma}\left(\log t, \color{blue}{-z}, \left(x + y\right) + z\right)\right) \]
  4. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a + -0.5, b, \mathsf{fma}\left(\log t, -z, x + \left(y + z\right)\right)\right)} \]
  5. Final simplification99.9%

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

Alternative 2: 90.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(z, 1 - \log t, x + 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) < -4.99999999999999989e37 or 5.0000000000000002e107 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6492.9

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

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

    if -4.99999999999999989e37 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 5.0000000000000002e107

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \left(x + y\right) + \color{blue}{\left(z - z \cdot \log t\right)} \]
      5. *-rgt-identityN/A

        \[\leadsto \left(x + y\right) + \left(\color{blue}{z \cdot 1} - z \cdot \log t\right) \]
      6. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right) + \left(x + y\right)} \]
      8. sub-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x + y\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x + y\right) \]
      13. lower--.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
      16. lower-+.f6496.1

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z, 1 - \log t, y + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) \leq -5 \cdot 10^{+37}:\\ \;\;\;\;y + \mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{elif}\;b \cdot \left(a - 0.5\right) \leq 5 \cdot 10^{+107}:\\ \;\;\;\;\mathsf{fma}\left(z, 1 - \log t, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;y + \mathsf{fma}\left(b, a + -0.5, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 22.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) + \left(\left(z + \left(x + y\right)\right) - \log t \cdot z\right) \leq -5 \cdot 10^{-147}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (+ (* b (- a 0.5)) (- (+ z (+ x y)) (* (log t) z))) -5e-147) x y))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((b * (a - 0.5)) + ((z + (x + y)) - (log(t) * z))) <= -5e-147) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    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
    real(8) :: tmp
    if (((b * (a - 0.5d0)) + ((z + (x + y)) - (log(t) * z))) <= (-5d-147)) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((b * (a - 0.5)) + ((z + (x + y)) - (Math.log(t) * z))) <= -5e-147) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if ((b * (a - 0.5)) + ((z + (x + y)) - (math.log(t) * z))) <= -5e-147:
		tmp = x
	else:
		tmp = y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(Float64(b * Float64(a - 0.5)) + Float64(Float64(z + Float64(x + y)) - Float64(log(t) * z))) <= -5e-147)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (((b * (a - 0.5)) + ((z + (x + y)) - (log(t) * z))) <= -5e-147)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(N[Log[t], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-147], x, y]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \cdot \left(a - 0.5\right) + \left(\left(z + \left(x + y\right)\right) - \log t \cdot z\right) \leq -5 \cdot 10^{-147}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)) < -5.00000000000000013e-147

    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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. lower-/.f6422.8

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    7. Applied rewrites22.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    8. Step-by-step derivation
      1. remove-double-div22.8

        \[\leadsto \color{blue}{x} \]
    9. Applied rewrites22.8%

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

    if -5.00000000000000013e-147 < (+.f64 (-.f64 (+.f64 (+.f64 x y) z) (*.f64 z (log.f64 t))) (*.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{y}}} \]
    6. Step-by-step derivation
      1. lower-/.f6423.4

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{y}}} \]
    7. Applied rewrites23.4%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{y}}} \]
    8. Step-by-step derivation
      1. remove-double-div23.5

        \[\leadsto \color{blue}{y} \]
    9. Applied rewrites23.5%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) + \left(\left(z + \left(x + y\right)\right) - \log t \cdot z\right) \leq -5 \cdot 10^{-147}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 58.3% accurate, 1.0× speedup?

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

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

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6483.4

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      3. sub-negN/A

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{-1}{2} + a}, x\right) \]
      6. lower-+.f6458.4

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{-0.5 + a}, x\right) \]
    8. Applied rewrites58.4%

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

    if -5.00000000000000013e-147 < (-.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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6478.5

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, y\right)} \]
      3. sub-negN/A

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, y\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, y\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{-1}{2} + a}, y\right) \]
      6. lower-+.f6457.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z + \left(x + y\right)\right) - \log t \cdot z \leq -5 \cdot 10^{-147}:\\ \;\;\;\;\mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, a + -0.5, y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.2% accurate, 1.0× speedup?

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

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

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


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

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6490.3

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

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

    if -1.00000000000000009e106 < (+.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. Add Preprocessing
    3. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, 1 + -1 \cdot \log t, y + b \cdot \left(a - \frac{1}{2}\right)\right)} \]
    5. Applied rewrites83.6%

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

Alternative 6: 85.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 1 - \log t\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(z, t\_1, y\right)\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+232}:\\ \;\;\;\;y + \mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, t\_1, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- 1.0 (log t))))
   (if (<= z -2.9e+161)
     (fma z t_1 y)
     (if (<= z 1.25e+232) (+ y (fma b (+ a -0.5) x)) (fma z t_1 x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = 1.0 - log(t);
	double tmp;
	if (z <= -2.9e+161) {
		tmp = fma(z, t_1, y);
	} else if (z <= 1.25e+232) {
		tmp = y + fma(b, (a + -0.5), x);
	} else {
		tmp = fma(z, t_1, x);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(1.0 - log(t))
	tmp = 0.0
	if (z <= -2.9e+161)
		tmp = fma(z, t_1, y);
	elseif (z <= 1.25e+232)
		tmp = Float64(y + fma(b, Float64(a + -0.5), x));
	else
		tmp = fma(z, t_1, x);
	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[z, -2.9e+161], N[(z * t$95$1 + y), $MachinePrecision], If[LessEqual[z, 1.25e+232], N[(y + N[(b * N[(a + -0.5), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(z * t$95$1 + x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 1 - \log t\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(z, t\_1, y\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t\_1, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.90000000000000016e161

    1. Initial program 99.7%

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

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

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

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

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

        \[\leadsto \left(x + y\right) + \color{blue}{\left(z - z \cdot \log t\right)} \]
      5. *-rgt-identityN/A

        \[\leadsto \left(x + y\right) + \left(\color{blue}{z \cdot 1} - z \cdot \log t\right) \]
      6. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right) + \left(x + y\right)} \]
      8. sub-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x + y\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x + y\right) \]
      13. lower--.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
      16. lower-+.f6473.2

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
    5. Applied rewrites73.2%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, y\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, y\right) \]
      7. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, y\right) \]
      8. lower-log.f6465.7

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

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

    if -2.90000000000000016e161 < z < 1.24999999999999997e232

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6490.7

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

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

    if 1.24999999999999997e232 < z

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \left(x + y\right) + \color{blue}{\left(z - z \cdot \log t\right)} \]
      5. *-rgt-identityN/A

        \[\leadsto \left(x + y\right) + \left(\color{blue}{z \cdot 1} - z \cdot \log t\right) \]
      6. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right) + \left(x + y\right)} \]
      8. sub-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x + y\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x + y\right) \]
      13. lower--.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
      16. lower-+.f6493.3

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
    5. Applied rewrites93.3%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x\right) \]
      6. sub-negN/A

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

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x\right) \]
      8. lower-log.f6480.8

        \[\leadsto \mathsf{fma}\left(z, 1 - \color{blue}{\log t}, x\right) \]
    8. Applied rewrites80.8%

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

Alternative 7: 85.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, 1 - \log t, x\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.10000000000000007e161 or 1.24999999999999997e232 < z

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \left(x + y\right) + \color{blue}{\left(z - z \cdot \log t\right)} \]
      5. *-rgt-identityN/A

        \[\leadsto \left(x + y\right) + \left(\color{blue}{z \cdot 1} - z \cdot \log t\right) \]
      6. distribute-lft-out--N/A

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

        \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right) + \left(x + y\right)} \]
      8. sub-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x + y\right) \]
      12. sub-negN/A

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x + y\right) \]
      13. lower--.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
      16. lower-+.f6481.0

        \[\leadsto \mathsf{fma}\left(z, 1 - \log t, \color{blue}{y + x}\right) \]
    5. Applied rewrites81.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(z, 1 + \color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}, x\right) \]
      6. sub-negN/A

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

        \[\leadsto \mathsf{fma}\left(z, \color{blue}{1 - \log t}, x\right) \]
      8. lower-log.f6473.7

        \[\leadsto \mathsf{fma}\left(z, 1 - \color{blue}{\log t}, x\right) \]
    8. Applied rewrites73.7%

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

    if -3.10000000000000007e161 < z < 1.24999999999999997e232

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6490.7

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

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

Alternative 8: 84.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(-\log t, z, z\right)\\

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

\mathbf{else}:\\
\;\;\;\;z - \log t \cdot z\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.25e161

    1. Initial program 99.7%

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

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

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-inN/A

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. *-rgt-identityN/A

        \[\leadsto \color{blue}{z} + z \cdot \log \left(\frac{1}{t}\right) \]
      5. remove-double-negN/A

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

        \[\leadsto z + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(z \cdot \log \left(\frac{1}{t}\right)\right)}\right)\right) \]
      7. sub-negN/A

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

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

        \[\leadsto z - \color{blue}{\left(\mathsf{neg}\left(z \cdot \log \left(\frac{1}{t}\right)\right)\right)} \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto z - \color{blue}{z \cdot \left(\mathsf{neg}\left(\log \left(\frac{1}{t}\right)\right)\right)} \]
      11. log-recN/A

        \[\leadsto z - z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}\right)\right) \]
      12. remove-double-negN/A

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
      13. lower-*.f64N/A

        \[\leadsto z - \color{blue}{z \cdot \log t} \]
      14. lower-log.f6461.7

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
    5. Applied rewrites61.7%

      \[\leadsto \color{blue}{z - z \cdot \log t} \]
    6. Step-by-step derivation
      1. lift-log.f64N/A

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
      2. lift-*.f64N/A

        \[\leadsto z - \color{blue}{z \cdot \log t} \]
      3. sub-negN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\log t\right), z, z\right)} \]
      9. lower-neg.f6461.8

        \[\leadsto \mathsf{fma}\left(\color{blue}{-\log t}, z, z\right) \]
    7. Applied rewrites61.8%

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

    if -3.25e161 < z < 1.50000000000000008e235

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6490.7

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

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

    if 1.50000000000000008e235 < z

    1. Initial program 99.6%

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

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

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-inN/A

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. *-rgt-identityN/A

        \[\leadsto \color{blue}{z} + z \cdot \log \left(\frac{1}{t}\right) \]
      5. remove-double-negN/A

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

        \[\leadsto z + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(z \cdot \log \left(\frac{1}{t}\right)\right)}\right)\right) \]
      7. sub-negN/A

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

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

        \[\leadsto z - \color{blue}{\left(\mathsf{neg}\left(z \cdot \log \left(\frac{1}{t}\right)\right)\right)} \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto z - \color{blue}{z \cdot \left(\mathsf{neg}\left(\log \left(\frac{1}{t}\right)\right)\right)} \]
      11. log-recN/A

        \[\leadsto z - z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}\right)\right) \]
      12. remove-double-negN/A

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
      13. lower-*.f64N/A

        \[\leadsto z - \color{blue}{z \cdot \log t} \]
      14. lower-log.f6472.2

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
    5. Applied rewrites72.2%

      \[\leadsto \color{blue}{z - z \cdot \log t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.25 \cdot 10^{+161}:\\ \;\;\;\;\mathsf{fma}\left(-\log t, z, z\right)\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+235}:\\ \;\;\;\;y + \mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;z - \log t \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 84.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := z - \log t \cdot z\\
\mathbf{if}\;z \leq -3.25 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.25e161 or 1.50000000000000008e235 < z

    1. Initial program 99.6%

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

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

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

        \[\leadsto z \cdot \left(1 + \color{blue}{\log \left(\frac{1}{t}\right)}\right) \]
      3. distribute-lft-inN/A

        \[\leadsto \color{blue}{z \cdot 1 + z \cdot \log \left(\frac{1}{t}\right)} \]
      4. *-rgt-identityN/A

        \[\leadsto \color{blue}{z} + z \cdot \log \left(\frac{1}{t}\right) \]
      5. remove-double-negN/A

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

        \[\leadsto z + \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \left(z \cdot \log \left(\frac{1}{t}\right)\right)}\right)\right) \]
      7. sub-negN/A

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

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

        \[\leadsto z - \color{blue}{\left(\mathsf{neg}\left(z \cdot \log \left(\frac{1}{t}\right)\right)\right)} \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto z - \color{blue}{z \cdot \left(\mathsf{neg}\left(\log \left(\frac{1}{t}\right)\right)\right)} \]
      11. log-recN/A

        \[\leadsto z - z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\log t\right)\right)}\right)\right) \]
      12. remove-double-negN/A

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
      13. lower-*.f64N/A

        \[\leadsto z - \color{blue}{z \cdot \log t} \]
      14. lower-log.f6465.8

        \[\leadsto z - z \cdot \color{blue}{\log t} \]
    5. Applied rewrites65.8%

      \[\leadsto \color{blue}{z - z \cdot \log t} \]

    if -3.25e161 < z < 1.50000000000000008e235

    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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6490.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.25 \cdot 10^{+161}:\\ \;\;\;\;z - \log t \cdot z\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+235}:\\ \;\;\;\;y + \mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;z - \log t \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.3% accurate, 3.3× speedup?

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

\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
t_2 := \left(a + -0.5\right) \cdot b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+217}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+155}:\\
\;\;\;\;y + \mathsf{fma}\left(b, -0.5, x\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) < -1.99999999999999992e217 or 4.9999999999999999e155 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{b \cdot \left(a - \frac{1}{2}\right)} \]
      2. sub-negN/A

        \[\leadsto b \cdot \color{blue}{\left(a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \]
      3. metadata-evalN/A

        \[\leadsto b \cdot \left(a + \color{blue}{\frac{-1}{2}}\right) \]
      4. lower-+.f6486.1

        \[\leadsto b \cdot \color{blue}{\left(a + -0.5\right)} \]
    5. Applied rewrites86.1%

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

    if -1.99999999999999992e217 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999999e155

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6474.1

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

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

      \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{\frac{-1}{2}}, x\right) \]
    7. Step-by-step derivation
      1. Applied rewrites65.6%

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{-0.5}, x\right) \]
    8. Recombined 2 regimes into one program.
    9. Final simplification72.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) \leq -2 \cdot 10^{+217}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{elif}\;b \cdot \left(a - 0.5\right) \leq 5 \cdot 10^{+155}:\\ \;\;\;\;y + \mathsf{fma}\left(b, -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \end{array} \]
    10. Add Preprocessing

    Alternative 11: 65.4% accurate, 3.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ t_2 := \left(a + -0.5\right) \cdot b\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+217}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+155}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* b (- a 0.5))) (t_2 (* (+ a -0.5) b)))
       (if (<= t_1 -2e+217) t_2 (if (<= t_1 5e+155) (+ x y) t_2))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = b * (a - 0.5);
    	double t_2 = (a + -0.5) * b;
    	double tmp;
    	if (t_1 <= -2e+217) {
    		tmp = t_2;
    	} else if (t_1 <= 5e+155) {
    		tmp = x + y;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t, a, b)
        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
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = b * (a - 0.5d0)
        t_2 = (a + (-0.5d0)) * b
        if (t_1 <= (-2d+217)) then
            tmp = t_2
        else if (t_1 <= 5d+155) then
            tmp = x + y
        else
            tmp = t_2
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = b * (a - 0.5);
    	double t_2 = (a + -0.5) * b;
    	double tmp;
    	if (t_1 <= -2e+217) {
    		tmp = t_2;
    	} else if (t_1 <= 5e+155) {
    		tmp = x + y;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = b * (a - 0.5)
    	t_2 = (a + -0.5) * b
    	tmp = 0
    	if t_1 <= -2e+217:
    		tmp = t_2
    	elif t_1 <= 5e+155:
    		tmp = x + y
    	else:
    		tmp = t_2
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(b * Float64(a - 0.5))
    	t_2 = Float64(Float64(a + -0.5) * b)
    	tmp = 0.0
    	if (t_1 <= -2e+217)
    		tmp = t_2;
    	elseif (t_1 <= 5e+155)
    		tmp = Float64(x + y);
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = b * (a - 0.5);
    	t_2 = (a + -0.5) * b;
    	tmp = 0.0;
    	if (t_1 <= -2e+217)
    		tmp = t_2;
    	elseif (t_1 <= 5e+155)
    		tmp = x + y;
    	else
    		tmp = t_2;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + -0.5), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+217], t$95$2, If[LessEqual[t$95$1, 5e+155], N[(x + y), $MachinePrecision], t$95$2]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := b \cdot \left(a - 0.5\right)\\
    t_2 := \left(a + -0.5\right) \cdot b\\
    \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+217}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+155}:\\
    \;\;\;\;x + y\\
    
    \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) < -1.99999999999999992e217 or 4.9999999999999999e155 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

      1. Initial program 100.0%

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

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

          \[\leadsto \color{blue}{b \cdot \left(a - \frac{1}{2}\right)} \]
        2. sub-negN/A

          \[\leadsto b \cdot \color{blue}{\left(a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \]
        3. metadata-evalN/A

          \[\leadsto b \cdot \left(a + \color{blue}{\frac{-1}{2}}\right) \]
        4. lower-+.f6486.1

          \[\leadsto b \cdot \color{blue}{\left(a + -0.5\right)} \]
      5. Applied rewrites86.1%

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

      if -1.99999999999999992e217 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999999e155

      1. Initial program 99.8%

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

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6474.1

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

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

        \[\leadsto \color{blue}{x + y} \]
      7. Step-by-step derivation
        1. lower-+.f6461.6

          \[\leadsto \color{blue}{x + y} \]
      8. Applied rewrites61.6%

        \[\leadsto \color{blue}{x + y} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification69.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) \leq -2 \cdot 10^{+217}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{elif}\;b \cdot \left(a - 0.5\right) \leq 5 \cdot 10^{+155}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \end{array} \]
    5. Add Preprocessing

    Alternative 12: 58.3% accurate, 3.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+155}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (let* ((t_1 (* b (- a 0.5))))
       (if (<= t_1 -5e+250) (* a b) (if (<= t_1 5e+155) (+ x y) (* a b)))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = b * (a - 0.5);
    	double tmp;
    	if (t_1 <= -5e+250) {
    		tmp = a * b;
    	} else if (t_1 <= 5e+155) {
    		tmp = x + y;
    	} else {
    		tmp = a * b;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t, a, b)
        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
        real(8) :: t_1
        real(8) :: tmp
        t_1 = b * (a - 0.5d0)
        if (t_1 <= (-5d+250)) then
            tmp = a * b
        else if (t_1 <= 5d+155) then
            tmp = x + y
        else
            tmp = a * b
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double t_1 = b * (a - 0.5);
    	double tmp;
    	if (t_1 <= -5e+250) {
    		tmp = a * b;
    	} else if (t_1 <= 5e+155) {
    		tmp = x + y;
    	} else {
    		tmp = a * b;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	t_1 = b * (a - 0.5)
    	tmp = 0
    	if t_1 <= -5e+250:
    		tmp = a * b
    	elif t_1 <= 5e+155:
    		tmp = x + y
    	else:
    		tmp = a * b
    	return tmp
    
    function code(x, y, z, t, a, b)
    	t_1 = Float64(b * Float64(a - 0.5))
    	tmp = 0.0
    	if (t_1 <= -5e+250)
    		tmp = Float64(a * b);
    	elseif (t_1 <= 5e+155)
    		tmp = Float64(x + y);
    	else
    		tmp = Float64(a * b);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	t_1 = b * (a - 0.5);
    	tmp = 0.0;
    	if (t_1 <= -5e+250)
    		tmp = a * b;
    	elseif (t_1 <= 5e+155)
    		tmp = x + y;
    	else
    		tmp = a * b;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+250], N[(a * b), $MachinePrecision], If[LessEqual[t$95$1, 5e+155], N[(x + y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := b \cdot \left(a - 0.5\right)\\
    \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+250}:\\
    \;\;\;\;a \cdot b\\
    
    \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+155}:\\
    \;\;\;\;x + y\\
    
    \mathbf{else}:\\
    \;\;\;\;a \cdot b\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < -5.0000000000000002e250 or 4.9999999999999999e155 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b)

      1. Initial program 100.0%

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

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

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

          \[\leadsto \color{blue}{b \cdot a} \]
      5. Applied rewrites64.8%

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

      if -5.0000000000000002e250 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 4.9999999999999999e155

      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. Add Preprocessing
      3. Taylor expanded in z around 0

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6475.5

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

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

        \[\leadsto \color{blue}{x + y} \]
      7. Step-by-step derivation
        1. lower-+.f6460.4

          \[\leadsto \color{blue}{x + y} \]
      8. Applied rewrites60.4%

        \[\leadsto \color{blue}{x + y} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification61.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) \leq -5 \cdot 10^{+250}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;b \cdot \left(a - 0.5\right) \leq 5 \cdot 10^{+155}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
    5. Add Preprocessing

    Alternative 13: 53.2% accurate, 4.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -4 \cdot 10^{+110}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+77}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \end{array} \]
    (FPCore (x y z t a b)
     :precision binary64
     (if (<= (+ x y) -4e+110)
       (+ x y)
       (if (<= (+ x y) 4e+77) (* (+ a -0.5) b) (+ y (* a b)))))
    double code(double x, double y, double z, double t, double a, double b) {
    	double tmp;
    	if ((x + y) <= -4e+110) {
    		tmp = x + y;
    	} else if ((x + y) <= 4e+77) {
    		tmp = (a + -0.5) * b;
    	} else {
    		tmp = y + (a * b);
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t, a, b)
        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
        real(8) :: tmp
        if ((x + y) <= (-4d+110)) then
            tmp = x + y
        else if ((x + y) <= 4d+77) then
            tmp = (a + (-0.5d0)) * b
        else
            tmp = y + (a * b)
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	double tmp;
    	if ((x + y) <= -4e+110) {
    		tmp = x + y;
    	} else if ((x + y) <= 4e+77) {
    		tmp = (a + -0.5) * b;
    	} else {
    		tmp = y + (a * b);
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b):
    	tmp = 0
    	if (x + y) <= -4e+110:
    		tmp = x + y
    	elif (x + y) <= 4e+77:
    		tmp = (a + -0.5) * b
    	else:
    		tmp = y + (a * b)
    	return tmp
    
    function code(x, y, z, t, a, b)
    	tmp = 0.0
    	if (Float64(x + y) <= -4e+110)
    		tmp = Float64(x + y);
    	elseif (Float64(x + y) <= 4e+77)
    		tmp = Float64(Float64(a + -0.5) * b);
    	else
    		tmp = Float64(y + Float64(a * b));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b)
    	tmp = 0.0;
    	if ((x + y) <= -4e+110)
    		tmp = x + y;
    	elseif ((x + y) <= 4e+77)
    		tmp = (a + -0.5) * b;
    	else
    		tmp = y + (a * b);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e+110], N[(x + y), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 4e+77], N[(N[(a + -0.5), $MachinePrecision] * b), $MachinePrecision], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x + y \leq -4 \cdot 10^{+110}:\\
    \;\;\;\;x + y\\
    
    \mathbf{elif}\;x + y \leq 4 \cdot 10^{+77}:\\
    \;\;\;\;\left(a + -0.5\right) \cdot b\\
    
    \mathbf{else}:\\
    \;\;\;\;y + a \cdot b\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (+.f64 x y) < -4.0000000000000001e110

      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. Add Preprocessing
      3. Taylor expanded in z around 0

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6489.9

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

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

        \[\leadsto \color{blue}{x + y} \]
      7. Step-by-step derivation
        1. lower-+.f6476.0

          \[\leadsto \color{blue}{x + y} \]
      8. Applied rewrites76.0%

        \[\leadsto \color{blue}{x + y} \]

      if -4.0000000000000001e110 < (+.f64 x y) < 3.99999999999999993e77

      1. Initial program 99.8%

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

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

          \[\leadsto \color{blue}{b \cdot \left(a - \frac{1}{2}\right)} \]
        2. sub-negN/A

          \[\leadsto b \cdot \color{blue}{\left(a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right)} \]
        3. metadata-evalN/A

          \[\leadsto b \cdot \left(a + \color{blue}{\frac{-1}{2}}\right) \]
        4. lower-+.f6458.4

          \[\leadsto b \cdot \color{blue}{\left(a + -0.5\right)} \]
      5. Applied rewrites58.4%

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

      if 3.99999999999999993e77 < (+.f64 x y)

      1. Initial program 100.0%

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

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6488.8

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

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

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

          \[\leadsto y + \color{blue}{b \cdot a} \]
        2. lower-*.f6454.0

          \[\leadsto y + \color{blue}{b \cdot a} \]
      8. Applied rewrites54.0%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification61.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -4 \cdot 10^{+110}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x + y \leq 4 \cdot 10^{+77}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
    5. Add Preprocessing

    Alternative 14: 56.2% accurate, 6.6× speedup?

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

      1. Initial program 99.8%

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

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6476.5

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        3. sub-negN/A

          \[\leadsto \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        4. metadata-evalN/A

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

          \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{-1}{2} + a}, x\right) \]
        6. lower-+.f6456.6

          \[\leadsto \mathsf{fma}\left(b, \color{blue}{-0.5 + a}, x\right) \]
      8. Applied rewrites56.6%

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

      if 3.99999999999999993e77 < (+.f64 x y)

      1. Initial program 100.0%

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

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

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

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

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

          \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
        5. sub-negN/A

          \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
        6. metadata-evalN/A

          \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
        7. lower-+.f6488.8

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

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

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

          \[\leadsto y + \color{blue}{b \cdot a} \]
        2. lower-*.f6454.0

          \[\leadsto y + \color{blue}{b \cdot a} \]
      8. Applied rewrites54.0%

        \[\leadsto y + \color{blue}{b \cdot a} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification55.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq 4 \cdot 10^{+77}:\\ \;\;\;\;\mathsf{fma}\left(b, a + -0.5, x\right)\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
    5. Add Preprocessing

    Alternative 15: 78.5% accurate, 9.7× speedup?

    \[\begin{array}{l} \\ y + \mathsf{fma}\left(b, a + -0.5, x\right) \end{array} \]
    (FPCore (x y z t a b) :precision binary64 (+ y (fma b (+ a -0.5) x)))
    double code(double x, double y, double z, double t, double a, double b) {
    	return y + fma(b, (a + -0.5), x);
    }
    
    function code(x, y, z, t, a, b)
    	return Float64(y + fma(b, Float64(a + -0.5), x))
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(y + N[(b * N[(a + -0.5), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    y + \mathsf{fma}\left(b, a + -0.5, 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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6480.8

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

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

    Alternative 16: 42.2% accurate, 31.5× speedup?

    \[\begin{array}{l} \\ x + y \end{array} \]
    (FPCore (x y z t a b) :precision binary64 (+ x y))
    double code(double x, double y, double z, double t, double a, double b) {
    	return x + y;
    }
    
    real(8) function code(x, y, z, t, a, b)
        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
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	return x + y;
    }
    
    def code(x, y, z, t, a, b):
    	return x + y
    
    function code(x, y, z, t, a, b)
    	return Float64(x + y)
    end
    
    function tmp = code(x, y, z, t, a, b)
    	tmp = x + y;
    end
    
    code[x_, y_, z_, t_, a_, b_] := N[(x + y), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    x + y
    \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. Add Preprocessing
    3. Taylor expanded in z around 0

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

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

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

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

        \[\leadsto y + \color{blue}{\mathsf{fma}\left(b, a - \frac{1}{2}, x\right)} \]
      5. sub-negN/A

        \[\leadsto y + \mathsf{fma}\left(b, \color{blue}{a + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x\right) \]
      6. metadata-evalN/A

        \[\leadsto y + \mathsf{fma}\left(b, a + \color{blue}{\frac{-1}{2}}, x\right) \]
      7. lower-+.f6480.8

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

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

      \[\leadsto \color{blue}{x + y} \]
    7. Step-by-step derivation
      1. lower-+.f6445.7

        \[\leadsto \color{blue}{x + y} \]
    8. Applied rewrites45.7%

      \[\leadsto \color{blue}{x + y} \]
    9. Add Preprocessing

    Alternative 17: 22.6% accurate, 126.0× speedup?

    \[\begin{array}{l} \\ x \end{array} \]
    (FPCore (x y z t a b) :precision binary64 x)
    double code(double x, double y, double z, double t, double a, double b) {
    	return x;
    }
    
    real(8) function code(x, y, z, t, a, b)
        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
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b) {
    	return x;
    }
    
    def code(x, y, z, t, a, b):
    	return x
    
    function code(x, y, z, t, a, b)
    	return x
    end
    
    function tmp = code(x, y, z, t, a, b)
    	tmp = x;
    end
    
    code[x_, y_, z_, t_, a_, b_] := x
    
    \begin{array}{l}
    
    \\
    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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    6. Step-by-step derivation
      1. lower-/.f6422.5

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    7. Applied rewrites22.5%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} \]
    8. Step-by-step derivation
      1. remove-double-div22.6

        \[\leadsto \color{blue}{x} \]
    9. Applied rewrites22.6%

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

    Developer Target 1: 99.6% accurate, 0.4× speedup?

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

    Reproduce

    ?
    herbie shell --seed 2024219 
    (FPCore (x y z t a b)
      :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
      :precision binary64
    
      :alt
      (! :herbie-platform default (+ (+ (+ x y) (/ (* (- 1 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 1/2) b)))
    
      (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))