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

Percentage Accurate: 99.8% → 99.8%
Time: 22.5s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 99.8% accurate, 0.7× speedup?

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

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

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Step-by-step derivation
    1. associate-+l+99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, t + \mathsf{fma}\left(x, \log y, z + a\right)\right)\right)} \]
  4. Step-by-step derivation
    1. fma-udef99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

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

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Final simplification99.8%

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

Alternative 3: 87.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;a \leq 2.16 \cdot 10^{+77}:\\
\;\;\;\;y \cdot i + \left(t + \left(z + \left(t_1 + b \cdot \log c\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.15999999999999992e77

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative97.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in a around 0 86.2%

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

    if 2.15999999999999992e77 < a

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 96.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 2.16 \cdot 10^{+77}:\\ \;\;\;\;y \cdot i + \left(t + \left(z + \left(x \cdot \log y + b \cdot \log c\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\ \end{array} \]

Alternative 4: 98.0% accurate, 1.0× speedup?

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

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

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

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
  3. Step-by-step derivation
    1. *-commutative98.2%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  4. Simplified98.2%

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  5. Final simplification98.2%

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

Alternative 5: 95.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+55} \lor \neg \left(x \leq 7 \cdot 10^{+84}\right):\\
\;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot i + \left(a + \left(t + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2000000000000001e55 or 6.9999999999999998e84 < x

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified99.7%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 92.0%

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

    if -4.2000000000000001e55 < x < 6.9999999999999998e84

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+55} \lor \neg \left(x \leq 7 \cdot 10^{+84}\right):\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + \log c \cdot \left(b - 0.5\right)\right)\right)\right)\\ \end{array} \]

Alternative 6: 91.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{+152} \lor \neg \left(b \leq 1.5 \cdot 10^{+173}\right):\\
\;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -3.5999999999999999e152 or 1.4999999999999999e173 < b

    1. Initial program 99.7%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified99.7%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in a around 0 98.0%

      \[\leadsto \color{blue}{\left(t + \left(z + \left(b \cdot \log c + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 92.6%

      \[\leadsto \left(t + \color{blue}{\left(z + b \cdot \log c\right)}\right) + y \cdot i \]

    if -3.5999999999999999e152 < b < 1.4999999999999999e173

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative97.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 94.0%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.6 \cdot 10^{+152} \lor \neg \left(b \leq 1.5 \cdot 10^{+173}\right):\\ \;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\ \end{array} \]

Alternative 7: 84.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -11500000 \lor \neg \left(x \leq 5.5 \cdot 10^{+84}\right):\\
\;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.15e7 or 5.5000000000000004e84 < x

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 92.8%

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

    if -1.15e7 < x < 5.5000000000000004e84

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, t + \mathsf{fma}\left(x, \log y, z + a\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -11500000 \lor \neg \left(x \leq 5.5 \cdot 10^{+84}\right):\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(b + -0.5\right) \cdot \log c + a\right) + \left(y \cdot i + z\right)\\ \end{array} \]

Alternative 8: 91.4% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{+150}:\\
\;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\

\mathbf{elif}\;b \leq 2.8 \cdot 10^{+165}:\\
\;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(b + -0.5\right) \cdot \log c + a\right) + \left(y \cdot i + t\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -6.99999999999999968e150

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in a around 0 99.9%

      \[\leadsto \color{blue}{\left(t + \left(z + \left(b \cdot \log c + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 99.9%

      \[\leadsto \left(t + \color{blue}{\left(z + b \cdot \log c\right)}\right) + y \cdot i \]

    if -6.99999999999999968e150 < b < 2.7999999999999998e165

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative97.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 94.0%

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

    if 2.7999999999999998e165 < b

    1. Initial program 99.6%

      \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \color{blue}{t + \left(\left(x \cdot \log y + z\right) + a\right)}\right)\right) \]
      13. associate-+l+99.7%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, t + \mathsf{fma}\left(x, \log y, z + a\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7 \cdot 10^{+150}:\\ \;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{+165}:\\ \;\;\;\;y \cdot i + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(b + -0.5\right) \cdot \log c + a\right) + \left(y \cdot i + t\right)\\ \end{array} \]

Alternative 9: 72.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 7.5 \cdot 10^{+127}:\\
\;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\

\mathbf{elif}\;a \leq 5.6 \cdot 10^{+170}:\\
\;\;\;\;a + \left(t + \left(z + x \cdot \log y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 7.4999999999999996e127

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative97.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in a around 0 85.5%

      \[\leadsto \color{blue}{\left(t + \left(z + \left(b \cdot \log c + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 69.7%

      \[\leadsto \left(t + \color{blue}{\left(z + b \cdot \log c\right)}\right) + y \cdot i \]

    if 7.4999999999999996e127 < a < 5.6000000000000003e170

    1. Initial program 99.6%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative99.6%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified99.6%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 99.6%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in y around 0 99.6%

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

    if 5.6000000000000003e170 < a

    1. Initial program 100.0%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified100.0%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 96.5%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 85.0%

      \[\leadsto \color{blue}{a + \left(t + \left(z + i \cdot y\right)\right)} \]
    7. Step-by-step derivation
      1. associate-+r+85.0%

        \[\leadsto \color{blue}{\left(a + t\right) + \left(z + i \cdot y\right)} \]
      2. +-commutative85.0%

        \[\leadsto \color{blue}{\left(t + a\right)} + \left(z + i \cdot y\right) \]
      3. *-commutative85.0%

        \[\leadsto \left(t + a\right) + \left(z + \color{blue}{y \cdot i}\right) \]
    8. Simplified85.0%

      \[\leadsto \color{blue}{\left(t + a\right) + \left(z + y \cdot i\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification72.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 7.5 \cdot 10^{+127}:\\ \;\;\;\;y \cdot i + \left(t + \left(z + b \cdot \log c\right)\right)\\ \mathbf{elif}\;a \leq 5.6 \cdot 10^{+170}:\\ \;\;\;\;a + \left(t + \left(z + x \cdot \log y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t + a\right) + \left(y \cdot i + z\right)\\ \end{array} \]

Alternative 10: 74.4% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+191} \lor \neg \left(x \leq 1.7 \cdot 10^{+139}\right):\\
\;\;\;\;y \cdot i + x \cdot \log y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.70000000000000004e191 or 1.7000000000000001e139 < x

    1. Initial program 99.7%

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

      \[\leadsto \color{blue}{x \cdot \log y} + y \cdot i \]

    if -1.70000000000000004e191 < x < 1.7000000000000001e139

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative97.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 82.9%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 78.9%

      \[\leadsto \color{blue}{a + \left(t + \left(z + i \cdot y\right)\right)} \]
    7. Step-by-step derivation
      1. associate-+r+78.9%

        \[\leadsto \color{blue}{\left(a + t\right) + \left(z + i \cdot y\right)} \]
      2. +-commutative78.9%

        \[\leadsto \color{blue}{\left(t + a\right)} + \left(z + i \cdot y\right) \]
      3. *-commutative78.9%

        \[\leadsto \left(t + a\right) + \left(z + \color{blue}{y \cdot i}\right) \]
    8. Simplified78.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+191} \lor \neg \left(x \leq 1.7 \cdot 10^{+139}\right):\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;\left(t + a\right) + \left(y \cdot i + z\right)\\ \end{array} \]

Alternative 11: 75.0% accurate, 2.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.49999999999999933e-9

    1. Initial program 99.8%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative98.2%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified98.2%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 82.8%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in y around 0 80.3%

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

    if 7.49999999999999933e-9 < y

    1. Initial program 99.9%

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

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
    3. Step-by-step derivation
      1. *-commutative98.3%

        \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    4. Simplified98.3%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
    5. Taylor expanded in b around 0 87.2%

      \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
    6. Taylor expanded in x around 0 77.1%

      \[\leadsto \color{blue}{a + \left(t + \left(z + i \cdot y\right)\right)} \]
    7. Step-by-step derivation
      1. associate-+r+77.1%

        \[\leadsto \color{blue}{\left(a + t\right) + \left(z + i \cdot y\right)} \]
      2. +-commutative77.1%

        \[\leadsto \color{blue}{\left(t + a\right)} + \left(z + i \cdot y\right) \]
      3. *-commutative77.1%

        \[\leadsto \left(t + a\right) + \left(z + \color{blue}{y \cdot i}\right) \]
    8. Simplified77.1%

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

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

Alternative 12: 67.7% accurate, 24.3× speedup?

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

\\
\left(t + a\right) + \left(y \cdot i + z\right)
\end{array}
Derivation
  1. Initial program 99.8%

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

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{b \cdot \log c}\right) + y \cdot i \]
  3. Step-by-step derivation
    1. *-commutative98.2%

      \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  4. Simplified98.2%

    \[\leadsto \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  5. Taylor expanded in b around 0 84.9%

    \[\leadsto \color{blue}{\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)} + y \cdot i \]
  6. Taylor expanded in x around 0 68.5%

    \[\leadsto \color{blue}{a + \left(t + \left(z + i \cdot y\right)\right)} \]
  7. Step-by-step derivation
    1. associate-+r+68.5%

      \[\leadsto \color{blue}{\left(a + t\right) + \left(z + i \cdot y\right)} \]
    2. +-commutative68.5%

      \[\leadsto \color{blue}{\left(t + a\right)} + \left(z + i \cdot y\right) \]
    3. *-commutative68.5%

      \[\leadsto \left(t + a\right) + \left(z + \color{blue}{y \cdot i}\right) \]
  8. Simplified68.5%

    \[\leadsto \color{blue}{\left(t + a\right) + \left(z + y \cdot i\right)} \]
  9. Final simplification68.5%

    \[\leadsto \left(t + a\right) + \left(y \cdot i + z\right) \]

Alternative 13: 43.0% accurate, 31.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 3.15 \cdot 10^{+145}:\\ \;\;\;\;y \cdot i + z\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + a\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= a 3.15e+145) (+ (* y i) z) (+ (* y i) a)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (a <= 3.15e+145) {
		tmp = (y * i) + z;
	} else {
		tmp = (y * i) + a;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    real(8) :: tmp
    if (a <= 3.15d+145) then
        tmp = (y * i) + z
    else
        tmp = (y * i) + a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (a <= 3.15e+145) {
		tmp = (y * i) + z;
	} else {
		tmp = (y * i) + a;
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	tmp = 0
	if a <= 3.15e+145:
		tmp = (y * i) + z
	else:
		tmp = (y * i) + a
	return tmp
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (a <= 3.15e+145)
		tmp = Float64(Float64(y * i) + z);
	else
		tmp = Float64(Float64(y * i) + a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b, c, i)
	tmp = 0.0;
	if (a <= 3.15e+145)
		tmp = (y * i) + z;
	else
		tmp = (y * i) + a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[a, 3.15e+145], N[(N[(y * i), $MachinePrecision] + z), $MachinePrecision], N[(N[(y * i), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq 3.15 \cdot 10^{+145}:\\
\;\;\;\;y \cdot i + z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 3.14999999999999998e145

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{z} + y \cdot i \]

    if 3.14999999999999998e145 < a

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 3.15 \cdot 10^{+145}:\\ \;\;\;\;y \cdot i + z\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + a\\ \end{array} \]

Alternative 14: 27.4% accurate, 43.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.2 \cdot 10^{+146}:\\
\;\;\;\;y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.1999999999999998e146

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{i \cdot y} \]
    3. Step-by-step derivation
      1. *-commutative23.6%

        \[\leadsto \color{blue}{y \cdot i} \]
    4. Simplified23.6%

      \[\leadsto \color{blue}{y \cdot i} \]

    if 2.1999999999999998e146 < a

    1. Initial program 99.9%

      \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    2. Step-by-step derivation
      1. associate-+l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, t + \mathsf{fma}\left(x, \log y, z + a\right)\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 2.2 \cdot 10^{+146}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]

Alternative 15: 38.4% accurate, 43.8× speedup?

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

\\
y \cdot i + a
\end{array}
Derivation
  1. Initial program 99.8%

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

    \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Final simplification37.8%

    \[\leadsto y \cdot i + a \]

Alternative 16: 16.5% accurate, 219.0× speedup?

\[\begin{array}{l} \\ a \end{array} \]
(FPCore (x y z t a b c i) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a;
}
real(8) function code(x, y, z, t, a, b, c, i)
    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), intent (in) :: c
    real(8), intent (in) :: i
    code = a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return a;
}
def code(x, y, z, t, a, b, c, i):
	return a
function code(x, y, z, t, a, b, c, i)
	return a
end
function tmp = code(x, y, z, t, a, b, c, i)
	tmp = a;
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := a
\begin{array}{l}

\\
a
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Step-by-step derivation
    1. associate-+l+99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, t + \mathsf{fma}\left(x, \log y, z + a\right)\right)\right)} \]
  4. Step-by-step derivation
    1. fma-udef99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a} \]
  7. Final simplification18.4%

    \[\leadsto a \]

Reproduce

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