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

Percentage Accurate: 99.8% → 99.9%
Time: 10.8s
Alternatives: 18
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 18 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.8% 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, 0.5× speedup?

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

\\
z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(a + -0.5, b, x + y\right)
\end{array}
Derivation
  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. Step-by-step derivation
    1. +-commutative99.8%

      \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
    2. associate--l+99.8%

      \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
    3. associate-+r+99.8%

      \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
    4. +-commutative99.8%

      \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
    5. *-lft-identity99.8%

      \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    6. metadata-eval99.8%

      \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    7. *-commutative99.8%

      \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    8. distribute-rgt-out--99.9%

      \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    9. metadata-eval99.9%

      \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    10. fma-define99.9%

      \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
    11. sub-neg99.9%

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

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

    \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(a + -0.5, b, x + y\right)} \]
  4. Add Preprocessing
  5. 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)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+83}:\\ \;\;\;\;x + \left(y + \left(a + -0.5\right) \cdot b\right)\\ \mathbf{elif}\;t\_1 \leq 2.5 \cdot 10^{+54}:\\ \;\;\;\;z \cdot \left(1 - \log t\right) + \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))))
   (if (<= t_1 -2e+83)
     (+ x (+ y (* (+ a -0.5) b)))
     (if (<= t_1 2.5e+54)
       (+ (* z (- 1.0 (log t))) (+ x y))
       (+ x (+ y (+ (* -0.5 b) (* 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 <= -2e+83) {
		tmp = x + (y + ((a + -0.5) * b));
	} else if (t_1 <= 2.5e+54) {
		tmp = (z * (1.0 - log(t))) + (x + y);
	} else {
		tmp = x + (y + ((-0.5 * b) + (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 <= (-2d+83)) then
        tmp = x + (y + ((a + (-0.5d0)) * b))
    else if (t_1 <= 2.5d+54) then
        tmp = (z * (1.0d0 - log(t))) + (x + y)
    else
        tmp = x + (y + (((-0.5d0) * b) + (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 <= -2e+83) {
		tmp = x + (y + ((a + -0.5) * b));
	} else if (t_1 <= 2.5e+54) {
		tmp = (z * (1.0 - Math.log(t))) + (x + y);
	} else {
		tmp = x + (y + ((-0.5 * b) + (a * b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	tmp = 0
	if t_1 <= -2e+83:
		tmp = x + (y + ((a + -0.5) * b))
	elif t_1 <= 2.5e+54:
		tmp = (z * (1.0 - math.log(t))) + (x + y)
	else:
		tmp = x + (y + ((-0.5 * b) + (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 <= -2e+83)
		tmp = Float64(x + Float64(y + Float64(Float64(a + -0.5) * b)));
	elseif (t_1 <= 2.5e+54)
		tmp = Float64(Float64(z * Float64(1.0 - log(t))) + Float64(x + y));
	else
		tmp = Float64(x + Float64(y + Float64(Float64(-0.5 * b) + 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 <= -2e+83)
		tmp = x + (y + ((a + -0.5) * b));
	elseif (t_1 <= 2.5e+54)
		tmp = (z * (1.0 - log(t))) + (x + y);
	else
		tmp = x + (y + ((-0.5 * b) + (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, -2e+83], N[(x + N[(y + N[(N[(a + -0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2.5e+54], N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(N[(-0.5 * b), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    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 a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 88.4%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-in88.4%

        \[\leadsto x + \left(y + \color{blue}{b \cdot \left(-0.5 + a\right)}\right) \]
      2. distribute-rgt-in88.4%

        \[\leadsto x + \left(y + \color{blue}{\left(-0.5 \cdot b + a \cdot b\right)}\right) \]
      3. +-commutative88.4%

        \[\leadsto x + \left(y + \color{blue}{\left(a \cdot b + -0.5 \cdot b\right)}\right) \]
      4. distribute-rgt-in88.4%

        \[\leadsto x + \left(y + \color{blue}{b \cdot \left(a + -0.5\right)}\right) \]
    6. Simplified88.4%

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

    if -2.00000000000000006e83 < (*.f64 (-.f64 a #s(literal 1/2 binary64)) b) < 2.50000000000000003e54

    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. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.8%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.8%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.8%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.8%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.8%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.8%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.8%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.8%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.8%

        \[\leadsto z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(\color{blue}{a + \left(-0.5\right)}, b, x + y\right) \]
      12. metadata-eval99.8%

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

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

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

    if 2.50000000000000003e54 < (*.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. Taylor expanded in a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 90.2%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.3%

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

Alternative 3: 79.3% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(y + \left(z + t\_2\right)\right) - t\_1\\


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

    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 y around 0 79.6%

      \[\leadsto \left(\color{blue}{\left(x + z\right)} - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative79.6%

        \[\leadsto \left(\color{blue}{\left(z + x\right)} - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    5. Simplified79.6%

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

    if -5.0000000000000002e-28 < (+.f64 x y)

    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 x around 0 78.3%

      \[\leadsto \color{blue}{\left(y + \left(z + b \cdot \left(a - 0.5\right)\right)\right) - z \cdot \log t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.8%

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

Alternative 4: 83.4% accurate, 1.0× speedup?

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

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

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


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

    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 y around 0 85.6%

      \[\leadsto \left(\color{blue}{\left(x + z\right)} - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. +-commutative85.6%

        \[\leadsto \left(\color{blue}{\left(z + x\right)} - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    5. Simplified85.6%

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

    if 5.0000000000000002e46 < (+.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 a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 85.7%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-in85.7%

        \[\leadsto x + \left(y + \color{blue}{b \cdot \left(-0.5 + a\right)}\right) \]
      2. distribute-rgt-in85.7%

        \[\leadsto x + \left(y + \color{blue}{\left(-0.5 \cdot b + a \cdot b\right)}\right) \]
      3. +-commutative85.7%

        \[\leadsto x + \left(y + \color{blue}{\left(a \cdot b + -0.5 \cdot b\right)}\right) \]
      4. distribute-rgt-in85.7%

        \[\leadsto x + \left(y + \color{blue}{b \cdot \left(a + -0.5\right)}\right) \]
    6. Simplified85.7%

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

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

Alternative 5: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{+173} \lor \neg \left(z \leq 2.7 \cdot 10^{+222}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= z -4.4e+173) (not (<= z 2.7e+222)))
   (+ (* z (- 1.0 (log t))) x)
   (+ x (+ y (+ (* -0.5 b) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((z <= -4.4e+173) || !(z <= 2.7e+222)) {
		tmp = (z * (1.0 - log(t))) + x;
	} else {
		tmp = x + (y + ((-0.5 * b) + (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 ((z <= (-4.4d+173)) .or. (.not. (z <= 2.7d+222))) then
        tmp = (z * (1.0d0 - log(t))) + x
    else
        tmp = x + (y + (((-0.5d0) * b) + (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 ((z <= -4.4e+173) || !(z <= 2.7e+222)) {
		tmp = (z * (1.0 - Math.log(t))) + x;
	} else {
		tmp = x + (y + ((-0.5 * b) + (a * b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (z <= -4.4e+173) or not (z <= 2.7e+222):
		tmp = (z * (1.0 - math.log(t))) + x
	else:
		tmp = x + (y + ((-0.5 * b) + (a * b)))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((z <= -4.4e+173) || !(z <= 2.7e+222))
		tmp = Float64(Float64(z * Float64(1.0 - log(t))) + x);
	else
		tmp = Float64(x + Float64(y + Float64(Float64(-0.5 * b) + Float64(a * b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((z <= -4.4e+173) || ~((z <= 2.7e+222)))
		tmp = (z * (1.0 - log(t))) + x;
	else
		tmp = x + (y + ((-0.5 * b) + (a * b)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.4e+173], N[Not[LessEqual[z, 2.7e+222]], $MachinePrecision]], N[(N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(y + N[(N[(-0.5 * b), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+173} \lor \neg \left(z \leq 2.7 \cdot 10^{+222}\right):\\
\;\;\;\;z \cdot \left(1 - \log t\right) + x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.4e173 or 2.70000000000000013e222 < z

    1. Initial program 99.5%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Step-by-step derivation
      1. +-commutative99.5%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.5%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.5%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.5%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.5%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.5%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.5%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.6%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.6%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.6%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.6%

        \[\leadsto z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(\color{blue}{a + \left(-0.5\right)}, b, x + y\right) \]
      12. metadata-eval99.6%

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

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

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

    if -4.4e173 < z < 2.70000000000000013e222

    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 a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 89.7%

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

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

Alternative 6: 99.8% accurate, 1.0× speedup?

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

\\
\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t
\end{array}
Derivation
  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 a around 0 99.9%

    \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
  4. Add Preprocessing

Alternative 7: 84.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{+184} \lor \neg \left(z \leq 1.25 \cdot 10^{+222}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= z -7.8e+184) (not (<= z 1.25e+222)))
   (* z (- 1.0 (log t)))
   (+ x (+ y (+ (* -0.5 b) (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((z <= -7.8e+184) || !(z <= 1.25e+222)) {
		tmp = z * (1.0 - log(t));
	} else {
		tmp = x + (y + ((-0.5 * b) + (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 ((z <= (-7.8d+184)) .or. (.not. (z <= 1.25d+222))) then
        tmp = z * (1.0d0 - log(t))
    else
        tmp = x + (y + (((-0.5d0) * b) + (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 ((z <= -7.8e+184) || !(z <= 1.25e+222)) {
		tmp = z * (1.0 - Math.log(t));
	} else {
		tmp = x + (y + ((-0.5 * b) + (a * b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (z <= -7.8e+184) or not (z <= 1.25e+222):
		tmp = z * (1.0 - math.log(t))
	else:
		tmp = x + (y + ((-0.5 * b) + (a * b)))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((z <= -7.8e+184) || !(z <= 1.25e+222))
		tmp = Float64(z * Float64(1.0 - log(t)));
	else
		tmp = Float64(x + Float64(y + Float64(Float64(-0.5 * b) + Float64(a * b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((z <= -7.8e+184) || ~((z <= 1.25e+222)))
		tmp = z * (1.0 - log(t));
	else
		tmp = x + (y + ((-0.5 * b) + (a * b)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.8e+184], N[Not[LessEqual[z, 1.25e+222]], $MachinePrecision]], N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(N[(-0.5 * b), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+184} \lor \neg \left(z \leq 1.25 \cdot 10^{+222}\right):\\
\;\;\;\;z \cdot \left(1 - \log t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.79999999999999942e184 or 1.25000000000000006e222 < z

    1. Initial program 99.5%

      \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
    2. Step-by-step derivation
      1. +-commutative99.5%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.5%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.5%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.5%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.5%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.5%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.5%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.6%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.6%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.6%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.6%

        \[\leadsto z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(\color{blue}{a + \left(-0.5\right)}, b, x + y\right) \]
      12. metadata-eval99.6%

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

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

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

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

    if -7.79999999999999942e184 < z < 1.25000000000000006e222

    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 a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 89.7%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.0%

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

Alternative 8: 99.8% accurate, 1.0× speedup?

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

\\
\left(\left(z + \left(x + y\right)\right) - z \cdot \log t\right) + b \cdot \left(a - 0.5\right)
\end{array}
Derivation
  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. Final simplification99.8%

    \[\leadsto \left(\left(z + \left(x + y\right)\right) - z \cdot \log t\right) + b \cdot \left(a - 0.5\right) \]
  4. Add Preprocessing

Alternative 9: 78.1% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -10000 \lor \neg \left(a - 0.5 \leq -0.49999999998\right):\\ \;\;\;\;x + \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + -0.5 \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= (- a 0.5) -10000.0) (not (<= (- a 0.5) -0.49999999998)))
   (+ x (+ y (* a b)))
   (+ x (+ y (* -0.5 b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((a - 0.5) <= -10000.0) || !((a - 0.5) <= -0.49999999998)) {
		tmp = x + (y + (a * b));
	} else {
		tmp = x + (y + (-0.5 * 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 (((a - 0.5d0) <= (-10000.0d0)) .or. (.not. ((a - 0.5d0) <= (-0.49999999998d0)))) then
        tmp = x + (y + (a * b))
    else
        tmp = x + (y + ((-0.5d0) * 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 (((a - 0.5) <= -10000.0) || !((a - 0.5) <= -0.49999999998)) {
		tmp = x + (y + (a * b));
	} else {
		tmp = x + (y + (-0.5 * b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if ((a - 0.5) <= -10000.0) or not ((a - 0.5) <= -0.49999999998):
		tmp = x + (y + (a * b))
	else:
		tmp = x + (y + (-0.5 * b))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((Float64(a - 0.5) <= -10000.0) || !(Float64(a - 0.5) <= -0.49999999998))
		tmp = Float64(x + Float64(y + Float64(a * b)));
	else
		tmp = Float64(x + Float64(y + Float64(-0.5 * b)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (((a - 0.5) <= -10000.0) || ~(((a - 0.5) <= -0.49999999998)))
		tmp = x + (y + (a * b));
	else
		tmp = x + (y + (-0.5 * b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -10000.0], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], -0.49999999998]], $MachinePrecision]], N[(x + N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -10000 \lor \neg \left(a - 0.5 \leq -0.49999999998\right):\\
\;\;\;\;x + \left(y + a \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;x + \left(y + -0.5 \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 a #s(literal 1/2 binary64)) < -1e4 or -0.49999999998 < (-.f64 a #s(literal 1/2 binary64))

    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 a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 80.5%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in a around inf 79.7%

      \[\leadsto x + \left(y + \color{blue}{a \cdot b}\right) \]
    6. Step-by-step derivation
      1. *-commutative79.7%

        \[\leadsto x + \left(y + \color{blue}{b \cdot a}\right) \]
    7. Simplified79.7%

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

    if -1e4 < (-.f64 a #s(literal 1/2 binary64)) < -0.49999999998

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 72.0%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in a around 0 71.4%

      \[\leadsto x + \left(y + \color{blue}{-0.5 \cdot b}\right) \]
    6. Step-by-step derivation
      1. *-commutative71.4%

        \[\leadsto x + \left(y + \color{blue}{b \cdot -0.5}\right) \]
    7. Simplified71.4%

      \[\leadsto x + \left(y + \color{blue}{b \cdot -0.5}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -10000 \lor \neg \left(a - 0.5 \leq -0.49999999998\right):\\ \;\;\;\;x + \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + -0.5 \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 69.4% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+80} \lor \neg \left(a - 0.5 \leq 2 \cdot 10^{+41}\right):\\ \;\;\;\;y + a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + -0.5 \cdot b\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= (- a 0.5) -5e+80) (not (<= (- a 0.5) 2e+41)))
   (+ y (* a b))
   (+ x (+ y (* -0.5 b)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((a - 0.5) <= -5e+80) || !((a - 0.5) <= 2e+41)) {
		tmp = y + (a * b);
	} else {
		tmp = x + (y + (-0.5 * 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 (((a - 0.5d0) <= (-5d+80)) .or. (.not. ((a - 0.5d0) <= 2d+41))) then
        tmp = y + (a * b)
    else
        tmp = x + (y + ((-0.5d0) * 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 (((a - 0.5) <= -5e+80) || !((a - 0.5) <= 2e+41)) {
		tmp = y + (a * b);
	} else {
		tmp = x + (y + (-0.5 * b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if ((a - 0.5) <= -5e+80) or not ((a - 0.5) <= 2e+41):
		tmp = y + (a * b)
	else:
		tmp = x + (y + (-0.5 * b))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((Float64(a - 0.5) <= -5e+80) || !(Float64(a - 0.5) <= 2e+41))
		tmp = Float64(y + Float64(a * b));
	else
		tmp = Float64(x + Float64(y + Float64(-0.5 * b)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (((a - 0.5) <= -5e+80) || ~(((a - 0.5) <= 2e+41)))
		tmp = y + (a * b);
	else
		tmp = x + (y + (-0.5 * b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[N[(a - 0.5), $MachinePrecision], -5e+80], N[Not[LessEqual[N[(a - 0.5), $MachinePrecision], 2e+41]], $MachinePrecision]], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(-0.5 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a - 0.5 \leq -5 \cdot 10^{+80} \lor \neg \left(a - 0.5 \leq 2 \cdot 10^{+41}\right):\\
\;\;\;\;y + a \cdot b\\

\mathbf{else}:\\
\;\;\;\;x + \left(y + -0.5 \cdot b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 a #s(literal 1/2 binary64)) < -4.99999999999999961e80 or 2.00000000000000001e41 < (-.f64 a #s(literal 1/2 binary64))

    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 73.8%

      \[\leadsto \color{blue}{\left(y + \left(z + b \cdot \left(a - 0.5\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 60.8%

      \[\leadsto \color{blue}{y + b \cdot \left(a - 0.5\right)} \]
    5. Taylor expanded in a around inf 60.8%

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

    if -4.99999999999999961e80 < (-.f64 a #s(literal 1/2 binary64)) < 2.00000000000000001e41

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 70.4%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in a around 0 67.5%

      \[\leadsto x + \left(y + \color{blue}{-0.5 \cdot b}\right) \]
    6. Step-by-step derivation
      1. *-commutative67.5%

        \[\leadsto x + \left(y + \color{blue}{b \cdot -0.5}\right) \]
    7. Simplified67.5%

      \[\leadsto x + \left(y + \color{blue}{b \cdot -0.5}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.9%

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

Alternative 11: 47.2% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{+160}:\\
\;\;\;\;x\\

\mathbf{elif}\;x + y \leq 100:\\
\;\;\;\;b \cdot \left(a - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;y + a \cdot b\\


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

    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. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.9%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.9%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.9%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.9%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.9%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.9%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.9%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.9%

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

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

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

      \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{x} \]
    6. Taylor expanded in z around 0 41.5%

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

    if -2.00000000000000001e160 < (+.f64 x y) < 100

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 68.1%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in b around inf 51.8%

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

    if 100 < (+.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 67.4%

      \[\leadsto \color{blue}{\left(y + \left(z + b \cdot \left(a - 0.5\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 49.8%

      \[\leadsto \color{blue}{y + b \cdot \left(a - 0.5\right)} \]
    5. Taylor expanded in a around inf 40.6%

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

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

Alternative 12: 61.5% accurate, 7.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.3 \cdot 10^{+51} \lor \neg \left(b \leq 2.4 \cdot 10^{+80}\right):\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= b -5.3e+51) (not (<= b 2.4e+80))) (* b (- a 0.5)) (+ x y)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((b <= -5.3e+51) || !(b <= 2.4e+80)) {
		tmp = b * (a - 0.5);
	} else {
		tmp = x + 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 <= (-5.3d+51)) .or. (.not. (b <= 2.4d+80))) then
        tmp = b * (a - 0.5d0)
    else
        tmp = x + 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 <= -5.3e+51) || !(b <= 2.4e+80)) {
		tmp = b * (a - 0.5);
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (b <= -5.3e+51) or not (b <= 2.4e+80):
		tmp = b * (a - 0.5)
	else:
		tmp = x + y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((b <= -5.3e+51) || !(b <= 2.4e+80))
		tmp = Float64(b * Float64(a - 0.5));
	else
		tmp = Float64(x + y);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((b <= -5.3e+51) || ~((b <= 2.4e+80)))
		tmp = b * (a - 0.5);
	else
		tmp = x + y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -5.3e+51], N[Not[LessEqual[b, 2.4e+80]], $MachinePrecision]], N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.3 \cdot 10^{+51} \lor \neg \left(b \leq 2.4 \cdot 10^{+80}\right):\\
\;\;\;\;b \cdot \left(a - 0.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -5.2999999999999997e51 or 2.39999999999999979e80 < 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. Taylor expanded in a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 90.7%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in b around inf 73.2%

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

    if -5.2999999999999997e51 < b < 2.39999999999999979e80

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 66.8%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in b around 0 56.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.3 \cdot 10^{+51} \lor \neg \left(b \leq 2.4 \cdot 10^{+80}\right):\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 50.9% accurate, 8.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{+134} \lor \neg \left(b \leq 1.7 \cdot 10^{+142}\right):\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -6.5e134 or 1.6999999999999999e142 < 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. Taylor expanded in a around 0 99.9%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 90.8%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in a around inf 49.0%

      \[\leadsto \color{blue}{a \cdot b} \]
    6. Step-by-step derivation
      1. *-commutative49.0%

        \[\leadsto \color{blue}{b \cdot a} \]
    7. Simplified49.0%

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

    if -6.5e134 < b < 1.6999999999999999e142

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 70.7%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in b around 0 53.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{+134} \lor \neg \left(b \leq 1.7 \cdot 10^{+142}\right):\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 28.9% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-248}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.1 \cdot 10^{+100}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -2.2e-248) x (if (<= y 6.1e+100) (* a b) y)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -2.2e-248) {
		tmp = x;
	} else if (y <= 6.1e+100) {
		tmp = a * b;
	} 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 (y <= (-2.2d-248)) then
        tmp = x
    else if (y <= 6.1d+100) then
        tmp = a * b
    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 (y <= -2.2e-248) {
		tmp = x;
	} else if (y <= 6.1e+100) {
		tmp = a * b;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -2.2e-248:
		tmp = x
	elif y <= 6.1e+100:
		tmp = a * b
	else:
		tmp = y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -2.2e-248)
		tmp = x;
	elseif (y <= 6.1e+100)
		tmp = Float64(a * b);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -2.2e-248)
		tmp = x;
	elseif (y <= 6.1e+100)
		tmp = a * b;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.2e-248], x, If[LessEqual[y, 6.1e+100], N[(a * b), $MachinePrecision], y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-248}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 6.1 \cdot 10^{+100}:\\
\;\;\;\;a \cdot b\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.19999999999999999e-248

    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. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.9%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.9%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.9%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.9%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.9%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.9%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.9%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.9%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.9%

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

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

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

      \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{x} \]
    6. Taylor expanded in z around 0 26.7%

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

    if -2.19999999999999999e-248 < y < 6.0999999999999999e100

    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 a around 0 99.8%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in z around 0 68.9%

      \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
    5. Taylor expanded in a around inf 27.6%

      \[\leadsto \color{blue}{a \cdot b} \]
    6. Step-by-step derivation
      1. *-commutative27.6%

        \[\leadsto \color{blue}{b \cdot a} \]
    7. Simplified27.6%

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

    if 6.0999999999999999e100 < 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 a around 0 100.0%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in y around inf 56.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-248}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.1 \cdot 10^{+100}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 78.6% accurate, 10.5× speedup?

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

\\
x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)
\end{array}
Derivation
  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 a around 0 99.9%

    \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
  4. Taylor expanded in z around 0 76.2%

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

Alternative 16: 78.6% accurate, 12.8× speedup?

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

\\
x + \left(y + \left(a + -0.5\right) \cdot b\right)
\end{array}
Derivation
  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 a around 0 99.9%

    \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
  4. Taylor expanded in z around 0 76.2%

    \[\leadsto \color{blue}{x + \left(y + \left(-0.5 \cdot b + a \cdot b\right)\right)} \]
  5. Step-by-step derivation
    1. distribute-rgt-in76.2%

      \[\leadsto x + \left(y + \color{blue}{b \cdot \left(-0.5 + a\right)}\right) \]
    2. distribute-rgt-in76.2%

      \[\leadsto x + \left(y + \color{blue}{\left(-0.5 \cdot b + a \cdot b\right)}\right) \]
    3. +-commutative76.2%

      \[\leadsto x + \left(y + \color{blue}{\left(a \cdot b + -0.5 \cdot b\right)}\right) \]
    4. distribute-rgt-in76.2%

      \[\leadsto x + \left(y + \color{blue}{b \cdot \left(a + -0.5\right)}\right) \]
  6. Simplified76.2%

    \[\leadsto \color{blue}{x + \left(y + b \cdot \left(a + -0.5\right)\right)} \]
  7. Final simplification76.2%

    \[\leadsto x + \left(y + \left(a + -0.5\right) \cdot b\right) \]
  8. Add Preprocessing

Alternative 17: 28.4% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 7 \cdot 10^{+38}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z t a b) :precision binary64 (if (<= y 7e+38) x y))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= 7e+38) {
		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 (y <= 7d+38) 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 (y <= 7e+38) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= 7e+38:
		tmp = x
	else:
		tmp = y
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= 7e+38)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= 7e+38)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 7e+38], x, y]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{+38}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.00000000000000003e38

    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. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
      2. associate--l+99.8%

        \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
      3. associate-+r+99.8%

        \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
      4. +-commutative99.8%

        \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
      5. *-lft-identity99.8%

        \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      6. metadata-eval99.8%

        \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      7. *-commutative99.8%

        \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      8. distribute-rgt-out--99.8%

        \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      9. metadata-eval99.8%

        \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
      10. fma-define99.8%

        \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
      11. sub-neg99.8%

        \[\leadsto z \cdot \left(1 - \log t\right) + \mathsf{fma}\left(\color{blue}{a + \left(-0.5\right)}, b, x + y\right) \]
      12. metadata-eval99.8%

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

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

      \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{x} \]
    6. Taylor expanded in z around 0 26.8%

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

    if 7.00000000000000003e38 < 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 a around 0 100.0%

      \[\leadsto \color{blue}{\left(x + \left(y + \left(z + \left(-0.5 \cdot b + a \cdot b\right)\right)\right)\right) - z \cdot \log t} \]
    4. Taylor expanded in y around inf 46.5%

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

Alternative 18: 22.3% accurate, 115.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.8%

    \[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
  2. Step-by-step derivation
    1. +-commutative99.8%

      \[\leadsto \color{blue}{\left(a - 0.5\right) \cdot b + \left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right)} \]
    2. associate--l+99.8%

      \[\leadsto \left(a - 0.5\right) \cdot b + \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} \]
    3. associate-+r+99.8%

      \[\leadsto \color{blue}{\left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) + \left(z - z \cdot \log t\right)} \]
    4. +-commutative99.8%

      \[\leadsto \color{blue}{\left(z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right)} \]
    5. *-lft-identity99.8%

      \[\leadsto \left(\color{blue}{1 \cdot z} - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    6. metadata-eval99.8%

      \[\leadsto \left(\color{blue}{\left(--1\right)} \cdot z - z \cdot \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    7. *-commutative99.8%

      \[\leadsto \left(\left(--1\right) \cdot z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    8. distribute-rgt-out--99.9%

      \[\leadsto \color{blue}{z \cdot \left(\left(--1\right) - \log t\right)} + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    9. metadata-eval99.9%

      \[\leadsto z \cdot \left(\color{blue}{1} - \log t\right) + \left(\left(a - 0.5\right) \cdot b + \left(x + y\right)\right) \]
    10. fma-define99.9%

      \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{\mathsf{fma}\left(a - 0.5, b, x + y\right)} \]
    11. sub-neg99.9%

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

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

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

    \[\leadsto z \cdot \left(1 - \log t\right) + \color{blue}{x} \]
  6. Taylor expanded in z around 0 25.6%

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

Developer Target 1: 99.5% 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 2024139 
(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)))