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

Percentage Accurate: 99.8% → 99.9%
Time: 11.1s
Alternatives: 22
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 22 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.4× speedup?

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

\\
x + \mathsf{fma}\left(z, 1 - \log t, \mathsf{fma}\left(a + -0.5, b, y\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. Step-by-step derivation
    1. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 81.8% accurate, 1.0× speedup?

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

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

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


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

    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. add-sqr-sqrt53.8%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr53.8%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/253.8%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down28.6%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/228.6%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/228.6%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr28.6%

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

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

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

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

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

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

    if -5.0000000000000002e-109 < (+.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. Taylor expanded in x around 0 79.3%

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

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

Alternative 3: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 4: 87.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+122}:\\
\;\;\;\;\left(x + y\right) + z \cdot \left(1 - \log t\right)\\

\mathbf{elif}\;z \leq 5.9 \cdot 10^{+150}:\\
\;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x + y\right) + z \cdot \left(1 + \log \left(\frac{1}{t}\right)\right)\\


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

    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. associate--l+99.5%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.45e122 < z < 5.90000000000000023e150

    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. Step-by-step derivation
      1. add-sqr-sqrt51.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr51.2%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/251.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down28.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr28.9%

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

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

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

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

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

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

    if 5.90000000000000023e150 < 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. associate--l+99.5%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.5%

        \[\leadsto x + \left(\color{blue}{\left(z + \left(-\log t\right) \cdot z\right)} + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      10. distribute-rgt1-in99.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+122}:\\ \;\;\;\;\left(x + y\right) + z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{+150}:\\ \;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + z \cdot \left(1 + \log \left(\frac{1}{t}\right)\right)\\ \end{array} \]

Alternative 5: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x + y\right) + \left(z - z \cdot \log t\right)\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(x + y) + Float64(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[(x + y), $MachinePrecision] + N[(z - N[(z * N[Log[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot b
\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. Step-by-step derivation
    1. associate--l+99.9%

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

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

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

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

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

Alternative 6: 87.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+124} \lor \neg \left(z \leq 3.7 \cdot 10^{+152}\right):\\
\;\;\;\;\left(x + y\right) + z \cdot \left(1 - \log t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.7999999999999998e124 or 3.69999999999999996e152 < 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. associate--l+99.5%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.5%

        \[\leadsto x + \left(\color{blue}{\left(z + \left(-\log t\right) \cdot z\right)} + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      10. distribute-rgt1-in99.7%

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

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

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

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

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

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

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

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

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

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

    if -3.7999999999999998e124 < z < 3.69999999999999996e152

    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. Step-by-step derivation
      1. add-sqr-sqrt51.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr51.2%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/251.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down28.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr28.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+124} \lor \neg \left(z \leq 3.7 \cdot 10^{+152}\right):\\ \;\;\;\;\left(x + y\right) + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 7: 84.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+124} \lor \neg \left(z \leq 1.86 \cdot 10^{+155}\right):\\
\;\;\;\;x + z \cdot \left(1 - \log t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.80000000000000043e124 or 1.86000000000000008e155 < 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. associate--l+99.5%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.5%

        \[\leadsto x + \left(\color{blue}{\left(z + \left(-\log t\right) \cdot z\right)} + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      10. distribute-rgt1-in99.7%

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

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

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

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

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

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

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

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

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

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

    if -5.80000000000000043e124 < z < 1.86000000000000008e155

    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. Step-by-step derivation
      1. add-sqr-sqrt51.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr51.2%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/251.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down28.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/228.9%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr28.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+124} \lor \neg \left(z \leq 1.86 \cdot 10^{+155}\right):\\ \;\;\;\;x + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 8: 85.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+124}:\\
\;\;\;\;x + z \cdot \left(1 - \log t\right)\\

\mathbf{elif}\;z \leq 1.08 \cdot 10^{+164}:\\
\;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\

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


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

    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. associate--l+99.5%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.5%

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

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

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

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

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

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

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

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

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

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

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

    if -5.39999999999999956e124 < z < 1.08e164

    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. Step-by-step derivation
      1. add-sqr-sqrt51.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr51.2%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/251.2%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down29.1%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/229.1%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/229.1%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr29.1%

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

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

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

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

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

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

    if 1.08e164 < 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. Taylor expanded in x around 0 96.2%

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

      \[\leadsto \color{blue}{\left(y + z\right)} - z \cdot \log t \]
    4. Step-by-step derivation
      1. +-commutative80.8%

        \[\leadsto \color{blue}{\left(z + y\right)} - z \cdot \log t \]
    5. Simplified80.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+124}:\\ \;\;\;\;x + z \cdot \left(1 - \log t\right)\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+164}:\\ \;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + y\right) - z \cdot \log t\\ \end{array} \]

Alternative 9: 83.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+164} \lor \neg \left(z \leq 7.2 \cdot 10^{+164}\right):\\
\;\;\;\;z \cdot \left(1 - \log t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.90000000000000011e164 or 7.19999999999999981e164 < 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. Taylor expanded in a around 0 99.5%

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

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

    if -1.90000000000000011e164 < z < 7.19999999999999981e164

    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. add-sqr-sqrt50.7%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    3. Applied egg-rr50.7%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
    4. Step-by-step derivation
      1. pow1/250.7%

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

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      3. unpow-prod-down28.2%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      4. pow1/228.2%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
      5. pow1/228.2%

        \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. Applied egg-rr28.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{+164} \lor \neg \left(z \leq 7.2 \cdot 10^{+164}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right)\\ \end{array} \]

Alternative 10: 64.7% accurate, 3.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^{+180} \lor \neg \left(t_1 \leq 10^{+57} \lor \neg \left(t_1 \leq 10^{+127}\right) \land t_1 \leq 10^{+149}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5))))
   (if (or (<= t_1 -2e+180)
           (not
            (or (<= t_1 1e+57) (and (not (<= t_1 1e+127)) (<= t_1 1e+149)))))
     t_1
     (+ x y))))
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+180) || !((t_1 <= 1e+57) || (!(t_1 <= 1e+127) && (t_1 <= 1e+149)))) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_1 = b * (a - 0.5d0)
    if ((t_1 <= (-2d+180)) .or. (.not. (t_1 <= 1d+57) .or. (.not. (t_1 <= 1d+127)) .and. (t_1 <= 1d+149))) then
        tmp = t_1
    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 t_1 = b * (a - 0.5);
	double tmp;
	if ((t_1 <= -2e+180) || !((t_1 <= 1e+57) || (!(t_1 <= 1e+127) && (t_1 <= 1e+149)))) {
		tmp = t_1;
	} else {
		tmp = x + y;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	tmp = 0
	if (t_1 <= -2e+180) or not ((t_1 <= 1e+57) or (not (t_1 <= 1e+127) and (t_1 <= 1e+149))):
		tmp = t_1
	else:
		tmp = x + y
	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+180) || !((t_1 <= 1e+57) || (!(t_1 <= 1e+127) && (t_1 <= 1e+149))))
		tmp = t_1;
	else
		tmp = Float64(x + y);
	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+180) || ~(((t_1 <= 1e+57) || (~((t_1 <= 1e+127)) && (t_1 <= 1e+149)))))
		tmp = t_1;
	else
		tmp = x + y;
	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[Or[LessEqual[t$95$1, -2e+180], N[Not[Or[LessEqual[t$95$1, 1e+57], And[N[Not[LessEqual[t$95$1, 1e+127]], $MachinePrecision], LessEqual[t$95$1, 1e+149]]]], $MachinePrecision]], t$95$1, N[(x + y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := b \cdot \left(a - 0.5\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+180} \lor \neg \left(t_1 \leq 10^{+57} \lor \neg \left(t_1 \leq 10^{+127}\right) \land t_1 \leq 10^{+149}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 a 1/2) b) < -2e180 or 1.00000000000000005e57 < (*.f64 (-.f64 a 1/2) b) < 9.99999999999999955e126 or 1.00000000000000005e149 < (*.f64 (-.f64 a 1/2) b)

    1. Initial program 99.9%

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

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

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

    if -2e180 < (*.f64 (-.f64 a 1/2) b) < 1.00000000000000005e57 or 9.99999999999999955e126 < (*.f64 (-.f64 a 1/2) b) < 1.00000000000000005e149

    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. associate--l+99.8%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot \left(a - 0.5\right) \leq -2 \cdot 10^{+180} \lor \neg \left(b \cdot \left(a - 0.5\right) \leq 10^{+57} \lor \neg \left(b \cdot \left(a - 0.5\right) \leq 10^{+127}\right) \land b \cdot \left(a - 0.5\right) \leq 10^{+149}\right):\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 11: 53.2% accurate, 8.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-117}:\\
\;\;\;\;x + a \cdot b\\

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

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


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

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000012e-117 < (+.f64 x y) < 2e110

    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. Taylor expanded in a around 0 99.8%

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

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

    if 2e110 < (+.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. Step-by-step derivation
      1. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 46.5% accurate, 8.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-117}:\\
\;\;\;\;x + a \cdot b\\

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

\mathbf{else}:\\
\;\;\;\;y + -0.5 \cdot b\\


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

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000012e-117 < (+.f64 x y) < 1.99999999999999991e37

    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. Taylor expanded in a around 0 99.8%

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

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

    if 1.99999999999999991e37 < (+.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. Step-by-step derivation
      1. associate--l+99.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot b} + y \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -4 \cdot 10^{-117}:\\ \;\;\;\;x + a \cdot b\\ \mathbf{elif}\;x + y \leq 2 \cdot 10^{+37}:\\ \;\;\;\;b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y + -0.5 \cdot b\\ \end{array} \]

Alternative 13: 49.9% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq -4 \cdot 10^{-117}:\\ \;\;\;\;x + a \cdot b\\ \mathbf{elif}\;x + y \leq 0.1:\\ \;\;\;\;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) -4e-117)
   (+ x (* a b))
   (if (<= (+ x y) 0.1) (* 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) <= -4e-117) {
		tmp = x + (a * b);
	} else if ((x + y) <= 0.1) {
		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) <= (-4d-117)) then
        tmp = x + (a * b)
    else if ((x + y) <= 0.1d0) 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) <= -4e-117) {
		tmp = x + (a * b);
	} else if ((x + y) <= 0.1) {
		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) <= -4e-117:
		tmp = x + (a * b)
	elif (x + y) <= 0.1:
		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) <= -4e-117)
		tmp = Float64(x + Float64(a * b));
	elseif (Float64(x + y) <= 0.1)
		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) <= -4e-117)
		tmp = x + (a * b);
	elseif ((x + y) <= 0.1)
		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], -4e-117], N[(x + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 0.1], 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 -4 \cdot 10^{-117}:\\
\;\;\;\;x + a \cdot b\\

\mathbf{elif}\;x + y \leq 0.1:\\
\;\;\;\;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) < -4.00000000000000012e-117

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000012e-117 < (+.f64 x y) < 0.10000000000000001

    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. Taylor expanded in a around 0 99.8%

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

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

    if 0.10000000000000001 < (+.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. Step-by-step derivation
      1. associate--l+99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + y \]
    7. Step-by-step derivation
      1. *-commutative47.4%

        \[\leadsto \color{blue}{b \cdot a} + y \]
    8. Simplified47.4%

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

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

Alternative 14: 55.4% accurate, 10.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + y \leq 0.1:\\ \;\;\;\;x + 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) 0.1) (+ x (* 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) <= 0.1) {
		tmp = x + (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) <= 0.1d0) then
        tmp = x + (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) <= 0.1) {
		tmp = x + (b * (a - 0.5));
	} else {
		tmp = y + (a * b);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (x + y) <= 0.1:
		tmp = x + (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) <= 0.1)
		tmp = Float64(x + 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) <= 0.1)
		tmp = x + (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], 0.1], N[(x + N[(b * N[(a - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.10000000000000001 < (+.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. Step-by-step derivation
      1. associate--l+99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot b} + y \]
    7. Step-by-step derivation
      1. *-commutative47.4%

        \[\leadsto \color{blue}{b \cdot a} + y \]
    8. Simplified47.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq 0.1:\\ \;\;\;\;x + b \cdot \left(a - 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]

Alternative 15: 59.2% accurate, 10.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \left(a - 0.5\right)\\ \mathbf{if}\;x + y \leq 5 \cdot 10^{-125}:\\ \;\;\;\;x + t_1\\ \mathbf{else}:\\ \;\;\;\;y + t_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* b (- a 0.5)))) (if (<= (+ x y) 5e-125) (+ x t_1) (+ y t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = b * (a - 0.5);
	double tmp;
	if ((x + y) <= 5e-125) {
		tmp = x + t_1;
	} else {
		tmp = y + 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) :: tmp
    t_1 = b * (a - 0.5d0)
    if ((x + y) <= 5d-125) then
        tmp = x + t_1
    else
        tmp = y + 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 = b * (a - 0.5);
	double tmp;
	if ((x + y) <= 5e-125) {
		tmp = x + t_1;
	} else {
		tmp = y + t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = b * (a - 0.5)
	tmp = 0
	if (x + y) <= 5e-125:
		tmp = x + t_1
	else:
		tmp = y + t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(b * Float64(a - 0.5))
	tmp = 0.0
	if (Float64(x + y) <= 5e-125)
		tmp = Float64(x + t_1);
	else
		tmp = Float64(y + t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = b * (a - 0.5);
	tmp = 0.0;
	if ((x + y) <= 5e-125)
		tmp = x + t_1;
	else
		tmp = y + t_1;
	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[N[(x + y), $MachinePrecision], 5e-125], N[(x + t$95$1), $MachinePrecision], N[(y + t$95$1), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999967e-125 < (+.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. Step-by-step derivation
      1. associate--l+99.9%

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

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

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

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

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

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

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

Alternative 16: 79.2% accurate, 10.5× speedup?

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

\\
a \cdot b + \left(-0.5 \cdot b + \left(x + y\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. Taylor expanded in a around 0 99.9%

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

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

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

Alternative 17: 80.0% accurate, 10.5× speedup?

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

\\
\left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\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. Step-by-step derivation
    1. add-sqr-sqrt53.4%

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

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
  3. Applied egg-rr53.4%

    \[\leadsto \left(\left(\left(x + y\right) + z\right) - \color{blue}{{\left(\sqrt{z \cdot \log t}\right)}^{2}}\right) + \left(a - 0.5\right) \cdot b \]
  4. Step-by-step derivation
    1. pow1/253.4%

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

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left({\color{blue}{\left(\log t \cdot z\right)}}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    3. unpow-prod-down29.6%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\color{blue}{\left({\log t}^{0.5} \cdot {z}^{0.5}\right)}}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    4. pow1/229.6%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\color{blue}{\sqrt{\log t}} \cdot {z}^{0.5}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
    5. pow1/229.6%

      \[\leadsto \left(\left(\left(x + y\right) + z\right) - {\left(\sqrt{\log t} \cdot \color{blue}{\sqrt{z}}\right)}^{2}\right) + \left(a - 0.5\right) \cdot b \]
  5. Applied egg-rr29.6%

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

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

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

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

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

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

    \[\leadsto \left(z + \left(x + y\right)\right) + b \cdot \left(a - 0.5\right) \]

Alternative 18: 79.2% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \left(x + y\right) + \left(a + -0.5\right) \cdot b \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(Float64(x + 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[(N[(x + y), $MachinePrecision] + N[(N[(a + -0.5), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + y\right) + \left(a + -0.5\right) \cdot b
\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. Step-by-step derivation
    1. associate--l+99.9%

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

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

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

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

    \[\leadsto \color{blue}{\left(y + x\right)} + \left(a + -0.5\right) \cdot b \]
  5. Final simplification80.1%

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

Alternative 19: 29.1% accurate, 16.1× speedup?

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

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

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+111}:\\
\;\;\;\;a \cdot b\\

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


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

    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. associate--l+99.8%

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

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

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

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

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

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

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

        \[\leadsto x + \left(\left(z - \color{blue}{\log t \cdot z}\right) + \left(\left(a - 0.5\right) \cdot b + y\right)\right) \]
      9. cancel-sign-sub-inv99.8%

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

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

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

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

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

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

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

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

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

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

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

    if 2.70000000000000017e-197 < y < 1.2999999999999999e111

    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. Taylor expanded in a around 0 99.8%

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

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

        \[\leadsto \color{blue}{b \cdot a} \]
    5. Simplified26.7%

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

    if 1.2999999999999999e111 < 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. Taylor expanded in a around 0 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.7 \cdot 10^{-197}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+111}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 20: 49.9% accurate, 16.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.3 \cdot 10^{+154}:\\
\;\;\;\;a \cdot b\\

\mathbf{elif}\;b \leq 1.85 \cdot 10^{+177}:\\
\;\;\;\;x + y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -4.2999999999999998e154 or 1.85000000000000007e177 < b

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{b \cdot a} \]
    5. Simplified51.1%

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

    if -4.2999999999999998e154 < b < 1.85000000000000007e177

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{+154}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;b \leq 1.85 \cdot 10^{+177}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]

Alternative 21: 28.5% accurate, 37.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+27}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.85000000000000001e27

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.85000000000000001e27 < x

    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. Taylor expanded in a around 0 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+27}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 22: 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.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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification24.4%

    \[\leadsto x \]

Developer target: 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 2023196 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))