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

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

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

\\
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b - 0.5, \log c, \mathsf{fma}\left(x, \log y, z + t\right) + a\right)\right)
\end{array}
Derivation
  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. +-commutative99.9%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
    10. associate-+l+99.9%

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

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

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

Alternative 3: 81.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.2 \cdot 10^{+50} \lor \neg \left(i \leq 4.5 \cdot 10^{-63}\right):\\
\;\;\;\;y \cdot i + \left(b \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -1.2000000000000001e50 or 4.5e-63 < i

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

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

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

    if -1.2000000000000001e50 < i < 4.5e-63

    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 t around 0 81.5%

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

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

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

Alternative 4: 81.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;i \leq 2 \cdot 10^{-64}:\\
\;\;\;\;t_1 + \left(a + \left(z + x \cdot \log y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -1.14999999999999998e50

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

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

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

    if -1.14999999999999998e50 < i < 1.99999999999999993e-64

    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 t around 0 81.5%

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

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

    if 1.99999999999999993e-64 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1.15 \cdot 10^{+50}:\\ \;\;\;\;y \cdot i + \left(b \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{elif}\;i \leq 2 \cdot 10^{-64}:\\ \;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + x \cdot \log y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, a + \left(\left(b - 0.5\right) \cdot \log c + \left(z + t\right)\right)\right)\\ \end{array} \]

Alternative 5: 84.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 6: 90.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+202} \lor \neg \left(x \leq 8.2 \cdot 10^{+211}\right):\\
\;\;\;\;\left(a + \left(z + x \cdot \log y\right)\right) + b \cdot \log c\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.4999999999999999e202 or 8.1999999999999998e211 < 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 t around 0 97.2%

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

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

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

    if -7.4999999999999999e202 < x < 8.1999999999999998e211

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

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

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

Alternative 7: 89.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(b - 0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{+222}:\\ \;\;\;\;t_2 + t_1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{+218}:\\ \;\;\;\;y \cdot i + \left(t_2 + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + t_1\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* x (log y))) (t_2 (* (- b 0.5) (log c))))
   (if (<= x -1.45e+222)
     (+ t_2 t_1)
     (if (<= x 2.8e+218) (+ (* y i) (+ t_2 (+ a (+ z t)))) (+ a (+ 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 t_2 = (b - 0.5) * log(c);
	double tmp;
	if (x <= -1.45e+222) {
		tmp = t_2 + t_1;
	} else if (x <= 2.8e+218) {
		tmp = (y * i) + (t_2 + (a + (z + t)));
	} else {
		tmp = a + (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) :: t_2
    real(8) :: tmp
    t_1 = x * log(y)
    t_2 = (b - 0.5d0) * log(c)
    if (x <= (-1.45d+222)) then
        tmp = t_2 + t_1
    else if (x <= 2.8d+218) then
        tmp = (y * i) + (t_2 + (a + (z + t)))
    else
        tmp = a + (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 t_2 = (b - 0.5) * Math.log(c);
	double tmp;
	if (x <= -1.45e+222) {
		tmp = t_2 + t_1;
	} else if (x <= 2.8e+218) {
		tmp = (y * i) + (t_2 + (a + (z + t)));
	} else {
		tmp = a + (z + t_1);
	}
	return tmp;
}
def code(x, y, z, t, a, b, c, i):
	t_1 = x * math.log(y)
	t_2 = (b - 0.5) * math.log(c)
	tmp = 0
	if x <= -1.45e+222:
		tmp = t_2 + t_1
	elif x <= 2.8e+218:
		tmp = (y * i) + (t_2 + (a + (z + t)))
	else:
		tmp = a + (z + t_1)
	return tmp
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(x * log(y))
	t_2 = Float64(Float64(b - 0.5) * log(c))
	tmp = 0.0
	if (x <= -1.45e+222)
		tmp = Float64(t_2 + t_1);
	elseif (x <= 2.8e+218)
		tmp = Float64(Float64(y * i) + Float64(t_2 + Float64(a + Float64(z + t))));
	else
		tmp = Float64(a + 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);
	t_2 = (b - 0.5) * log(c);
	tmp = 0.0;
	if (x <= -1.45e+222)
		tmp = t_2 + t_1;
	elseif (x <= 2.8e+218)
		tmp = (y * i) + (t_2 + (a + (z + t)));
	else
		tmp = a + (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]}, Block[{t$95$2 = N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e+222], N[(t$95$2 + t$95$1), $MachinePrecision], If[LessEqual[x, 2.8e+218], N[(N[(y * i), $MachinePrecision] + N[(t$95$2 + N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(z + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(b - 0.5\right) \cdot \log c\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{+222}:\\
\;\;\;\;t_2 + t_1\\

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

\mathbf{else}:\\
\;\;\;\;a + \left(z + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.44999999999999991e222

    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 t around 0 93.5%

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

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

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

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

    if -1.44999999999999991e222 < x < 2.7999999999999998e218

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

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

    if 2.7999999999999998e218 < 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 t around 0 99.8%

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

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

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

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

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

Alternative 8: 58.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a + \left(z + b \cdot \log c\right)\\ t_2 := \mathsf{fma}\left(y, i, z + a\right)\\ t_3 := a + \left(z + x \cdot \log y\right)\\ \mathbf{if}\;i \leq -4 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq -4.7 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 1.45 \cdot 10^{-302}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 3.4 \cdot 10^{-195}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 9 \cdot 10^{-90}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 0.00012:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ a (+ z (* b (log c)))))
        (t_2 (fma y i (+ z a)))
        (t_3 (+ a (+ z (* x (log y))))))
   (if (<= i -4e+59)
     t_2
     (if (<= i -4.7e-182)
       t_1
       (if (<= i 1.45e-302)
         t_3
         (if (<= i 3.4e-195)
           t_1
           (if (<= i 9e-90) t_3 (if (<= i 0.00012) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + (b * log(c)));
	double t_2 = fma(y, i, (z + a));
	double t_3 = a + (z + (x * log(y)));
	double tmp;
	if (i <= -4e+59) {
		tmp = t_2;
	} else if (i <= -4.7e-182) {
		tmp = t_1;
	} else if (i <= 1.45e-302) {
		tmp = t_3;
	} else if (i <= 3.4e-195) {
		tmp = t_1;
	} else if (i <= 9e-90) {
		tmp = t_3;
	} else if (i <= 0.00012) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(a + Float64(z + Float64(b * log(c))))
	t_2 = fma(y, i, Float64(z + a))
	t_3 = Float64(a + Float64(z + Float64(x * log(y))))
	tmp = 0.0
	if (i <= -4e+59)
		tmp = t_2;
	elseif (i <= -4.7e-182)
		tmp = t_1;
	elseif (i <= 1.45e-302)
		tmp = t_3;
	elseif (i <= 3.4e-195)
		tmp = t_1;
	elseif (i <= 9e-90)
		tmp = t_3;
	elseif (i <= 0.00012)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -4e+59], t$95$2, If[LessEqual[i, -4.7e-182], t$95$1, If[LessEqual[i, 1.45e-302], t$95$3, If[LessEqual[i, 3.4e-195], t$95$1, If[LessEqual[i, 9e-90], t$95$3, If[LessEqual[i, 0.00012], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a + \left(z + b \cdot \log c\right)\\
t_2 := \mathsf{fma}\left(y, i, z + a\right)\\
t_3 := a + \left(z + x \cdot \log y\right)\\
\mathbf{if}\;i \leq -4 \cdot 10^{+59}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;i \leq -4.7 \cdot 10^{-182}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 1.45 \cdot 10^{-302}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 3.4 \cdot 10^{-195}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 9 \cdot 10^{-90}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 0.00012:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -3.99999999999999989e59 or 1.20000000000000003e-4 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]

    if -3.99999999999999989e59 < i < -4.7e-182 or 1.44999999999999997e-302 < i < 3.40000000000000001e-195 or 9.00000000000000017e-90 < i < 1.20000000000000003e-4

    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 t around 0 81.9%

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

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

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

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

    if -4.7e-182 < i < 1.44999999999999997e-302 or 3.40000000000000001e-195 < i < 9.00000000000000017e-90

    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 t around 0 82.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{elif}\;i \leq -4.7 \cdot 10^{-182}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;i \leq 1.45 \cdot 10^{-302}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 3.4 \cdot 10^{-195}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;i \leq 9 \cdot 10^{-90}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 0.00012:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \]

Alternative 9: 60.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := b \cdot \log c\\ t_2 := a + \left(z + t_1\right)\\ t_3 := \mathsf{fma}\left(y, i, z + a\right)\\ t_4 := a + \left(z + x \cdot \log y\right)\\ \mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq -3.5 \cdot 10^{-183}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 5.1 \cdot 10^{-304}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{-195}:\\ \;\;\;\;t_1 + \left(a + \left(z + t\right)\right)\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{-90}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 0.000125:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (* b (log c)))
        (t_2 (+ a (+ z t_1)))
        (t_3 (fma y i (+ z a)))
        (t_4 (+ a (+ z (* x (log y))))))
   (if (<= i -6.2e+59)
     t_3
     (if (<= i -3.5e-183)
       t_2
       (if (<= i 5.1e-304)
         t_4
         (if (<= i 5.5e-195)
           (+ t_1 (+ a (+ z t)))
           (if (<= i 5.5e-90) t_4 (if (<= i 0.000125) t_2 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = b * log(c);
	double t_2 = a + (z + t_1);
	double t_3 = fma(y, i, (z + a));
	double t_4 = a + (z + (x * log(y)));
	double tmp;
	if (i <= -6.2e+59) {
		tmp = t_3;
	} else if (i <= -3.5e-183) {
		tmp = t_2;
	} else if (i <= 5.1e-304) {
		tmp = t_4;
	} else if (i <= 5.5e-195) {
		tmp = t_1 + (a + (z + t));
	} else if (i <= 5.5e-90) {
		tmp = t_4;
	} else if (i <= 0.000125) {
		tmp = t_2;
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(b * log(c))
	t_2 = Float64(a + Float64(z + t_1))
	t_3 = fma(y, i, Float64(z + a))
	t_4 = Float64(a + Float64(z + Float64(x * log(y))))
	tmp = 0.0
	if (i <= -6.2e+59)
		tmp = t_3;
	elseif (i <= -3.5e-183)
		tmp = t_2;
	elseif (i <= 5.1e-304)
		tmp = t_4;
	elseif (i <= 5.5e-195)
		tmp = Float64(t_1 + Float64(a + Float64(z + t)));
	elseif (i <= 5.5e-90)
		tmp = t_4;
	elseif (i <= 0.000125)
		tmp = t_2;
	else
		tmp = t_3;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a + N[(z + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -6.2e+59], t$95$3, If[LessEqual[i, -3.5e-183], t$95$2, If[LessEqual[i, 5.1e-304], t$95$4, If[LessEqual[i, 5.5e-195], N[(t$95$1 + N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5.5e-90], t$95$4, If[LessEqual[i, 0.000125], t$95$2, t$95$3]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := b \cdot \log c\\
t_2 := a + \left(z + t_1\right)\\
t_3 := \mathsf{fma}\left(y, i, z + a\right)\\
t_4 := a + \left(z + x \cdot \log y\right)\\
\mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq -3.5 \cdot 10^{-183}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;i \leq 5.1 \cdot 10^{-304}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;i \leq 5.5 \cdot 10^{-195}:\\
\;\;\;\;t_1 + \left(a + \left(z + t\right)\right)\\

\mathbf{elif}\;i \leq 5.5 \cdot 10^{-90}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;i \leq 0.000125:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -6.20000000000000029e59 or 1.25e-4 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]

    if -6.20000000000000029e59 < i < -3.49999999999999991e-183 or 5.5000000000000003e-90 < i < 1.25e-4

    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 t around 0 79.7%

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

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

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

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

    if -3.49999999999999991e-183 < i < 5.09999999999999979e-304 or 5.5000000000000003e-195 < i < 5.5000000000000003e-90

    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 t around 0 82.6%

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

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

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

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

    if 5.09999999999999979e-304 < i < 5.5000000000000003e-195

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{elif}\;i \leq -3.5 \cdot 10^{-183}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;i \leq 5.1 \cdot 10^{-304}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{-195}:\\ \;\;\;\;b \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{elif}\;i \leq 5.5 \cdot 10^{-90}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 0.000125:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \]

Alternative 10: 58.8% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a + \left(z + b \cdot \log c\right)\\ t_2 := \mathsf{fma}\left(y, i, z + a\right)\\ t_3 := a + \left(z + x \cdot \log y\right)\\ \mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq -6.5 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 4.5 \cdot 10^{-304}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 2.8 \cdot 10^{-195}:\\ \;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(z + a\right)\\ \mathbf{elif}\;i \leq 1.5 \cdot 10^{-88}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 0.00014:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ a (+ z (* b (log c)))))
        (t_2 (fma y i (+ z a)))
        (t_3 (+ a (+ z (* x (log y))))))
   (if (<= i -6.2e+59)
     t_2
     (if (<= i -6.5e-182)
       t_1
       (if (<= i 4.5e-304)
         t_3
         (if (<= i 2.8e-195)
           (+ (* (- b 0.5) (log c)) (+ z a))
           (if (<= i 1.5e-88) t_3 (if (<= i 0.00014) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + (b * log(c)));
	double t_2 = fma(y, i, (z + a));
	double t_3 = a + (z + (x * log(y)));
	double tmp;
	if (i <= -6.2e+59) {
		tmp = t_2;
	} else if (i <= -6.5e-182) {
		tmp = t_1;
	} else if (i <= 4.5e-304) {
		tmp = t_3;
	} else if (i <= 2.8e-195) {
		tmp = ((b - 0.5) * log(c)) + (z + a);
	} else if (i <= 1.5e-88) {
		tmp = t_3;
	} else if (i <= 0.00014) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(a + Float64(z + Float64(b * log(c))))
	t_2 = fma(y, i, Float64(z + a))
	t_3 = Float64(a + Float64(z + Float64(x * log(y))))
	tmp = 0.0
	if (i <= -6.2e+59)
		tmp = t_2;
	elseif (i <= -6.5e-182)
		tmp = t_1;
	elseif (i <= 4.5e-304)
		tmp = t_3;
	elseif (i <= 2.8e-195)
		tmp = Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(z + a));
	elseif (i <= 1.5e-88)
		tmp = t_3;
	elseif (i <= 0.00014)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -6.2e+59], t$95$2, If[LessEqual[i, -6.5e-182], t$95$1, If[LessEqual[i, 4.5e-304], t$95$3, If[LessEqual[i, 2.8e-195], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(z + a), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.5e-88], t$95$3, If[LessEqual[i, 0.00014], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a + \left(z + b \cdot \log c\right)\\
t_2 := \mathsf{fma}\left(y, i, z + a\right)\\
t_3 := a + \left(z + x \cdot \log y\right)\\
\mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;i \leq -6.5 \cdot 10^{-182}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 4.5 \cdot 10^{-304}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 2.8 \cdot 10^{-195}:\\
\;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(z + a\right)\\

\mathbf{elif}\;i \leq 1.5 \cdot 10^{-88}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 0.00014:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -6.20000000000000029e59 or 1.3999999999999999e-4 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]

    if -6.20000000000000029e59 < i < -6.49999999999999997e-182 or 1.5e-88 < i < 1.3999999999999999e-4

    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 t around 0 79.7%

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

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

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

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

    if -6.49999999999999997e-182 < i < 4.4999999999999998e-304 or 2.80000000000000003e-195 < i < 1.5e-88

    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 t around 0 82.6%

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

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

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

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

    if 4.4999999999999998e-304 < i < 2.80000000000000003e-195

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -6.2 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{elif}\;i \leq -6.5 \cdot 10^{-182}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;i \leq 4.5 \cdot 10^{-304}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 2.8 \cdot 10^{-195}:\\ \;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(z + a\right)\\ \mathbf{elif}\;i \leq 1.5 \cdot 10^{-88}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 0.00014:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \]

Alternative 11: 60.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := a + \left(z + b \cdot \log c\right)\\ t_2 := \mathsf{fma}\left(y, i, z + a\right)\\ t_3 := a + \left(z + x \cdot \log y\right)\\ \mathbf{if}\;i \leq -3.9 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq -2.5 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 2.6 \cdot 10^{-303}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 3.7 \cdot 10^{-195}:\\ \;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{elif}\;i \leq 1.55 \cdot 10^{-89}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq 0.00014:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (let* ((t_1 (+ a (+ z (* b (log c)))))
        (t_2 (fma y i (+ z a)))
        (t_3 (+ a (+ z (* x (log y))))))
   (if (<= i -3.9e+59)
     t_2
     (if (<= i -2.5e-182)
       t_1
       (if (<= i 2.6e-303)
         t_3
         (if (<= i 3.7e-195)
           (+ (* (- b 0.5) (log c)) (+ a (+ z t)))
           (if (<= i 1.55e-89) t_3 (if (<= i 0.00014) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double t_1 = a + (z + (b * log(c)));
	double t_2 = fma(y, i, (z + a));
	double t_3 = a + (z + (x * log(y)));
	double tmp;
	if (i <= -3.9e+59) {
		tmp = t_2;
	} else if (i <= -2.5e-182) {
		tmp = t_1;
	} else if (i <= 2.6e-303) {
		tmp = t_3;
	} else if (i <= 3.7e-195) {
		tmp = ((b - 0.5) * log(c)) + (a + (z + t));
	} else if (i <= 1.55e-89) {
		tmp = t_3;
	} else if (i <= 0.00014) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	t_1 = Float64(a + Float64(z + Float64(b * log(c))))
	t_2 = fma(y, i, Float64(z + a))
	t_3 = Float64(a + Float64(z + Float64(x * log(y))))
	tmp = 0.0
	if (i <= -3.9e+59)
		tmp = t_2;
	elseif (i <= -2.5e-182)
		tmp = t_1;
	elseif (i <= 2.6e-303)
		tmp = t_3;
	elseif (i <= 3.7e-195)
		tmp = Float64(Float64(Float64(b - 0.5) * log(c)) + Float64(a + Float64(z + t)));
	elseif (i <= 1.55e-89)
		tmp = t_3;
	elseif (i <= 0.00014)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a + N[(z + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.9e+59], t$95$2, If[LessEqual[i, -2.5e-182], t$95$1, If[LessEqual[i, 2.6e-303], t$95$3, If[LessEqual[i, 3.7e-195], N[(N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision] + N[(a + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.55e-89], t$95$3, If[LessEqual[i, 0.00014], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := a + \left(z + b \cdot \log c\right)\\
t_2 := \mathsf{fma}\left(y, i, z + a\right)\\
t_3 := a + \left(z + x \cdot \log y\right)\\
\mathbf{if}\;i \leq -3.9 \cdot 10^{+59}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;i \leq -2.5 \cdot 10^{-182}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;i \leq 2.6 \cdot 10^{-303}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 3.7 \cdot 10^{-195}:\\
\;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\

\mathbf{elif}\;i \leq 1.55 \cdot 10^{-89}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;i \leq 0.00014:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -3.90000000000000021e59 or 1.3999999999999999e-4 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]

    if -3.90000000000000021e59 < i < -2.50000000000000012e-182 or 1.54999999999999998e-89 < i < 1.3999999999999999e-4

    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 t around 0 79.7%

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

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

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

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

    if -2.50000000000000012e-182 < i < 2.60000000000000005e-303 or 3.69999999999999962e-195 < i < 1.54999999999999998e-89

    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 t around 0 82.6%

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

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

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

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

    if 2.60000000000000005e-303 < i < 3.69999999999999962e-195

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -3.9 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{elif}\;i \leq -2.5 \cdot 10^{-182}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;i \leq 2.6 \cdot 10^{-303}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 3.7 \cdot 10^{-195}:\\ \;\;\;\;\left(b - 0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{elif}\;i \leq 1.55 \cdot 10^{-89}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;i \leq 0.00014:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \]

Alternative 12: 89.0% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+253} \lor \neg \left(x \leq 1.85 \cdot 10^{+220}\right):\\
\;\;\;\;a + \left(z + x \cdot \log y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.20000000000000013e253 or 1.85e220 < 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 t around 0 99.8%

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

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

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

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

    if -6.20000000000000013e253 < x < 1.85e220

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

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

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

Alternative 13: 87.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+253} \lor \neg \left(x \leq 8 \cdot 10^{+222}\right):\\
\;\;\;\;a + \left(z + x \cdot \log y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.5999999999999998e253 or 8.0000000000000004e222 < 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 t around 0 99.8%

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

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

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

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

    if -6.5999999999999998e253 < x < 8.0000000000000004e222

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

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

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

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

Alternative 14: 58.7% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -7.8 \cdot 10^{+59} \lor \neg \left(i \leq 0.00015\right):\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= i -7.8e+59) (not (<= i 0.00015)))
   (fma y i (+ z a))
   (+ a (+ z (* b (log c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((i <= -7.8e+59) || !(i <= 0.00015)) {
		tmp = fma(y, i, (z + a));
	} else {
		tmp = a + (z + (b * log(c)));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((i <= -7.8e+59) || !(i <= 0.00015))
		tmp = fma(y, i, Float64(z + a));
	else
		tmp = Float64(a + Float64(z + Float64(b * log(c))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[i, -7.8e+59], N[Not[LessEqual[i, 0.00015]], $MachinePrecision]], N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision], N[(a + N[(z + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -7.8 \cdot 10^{+59} \lor \neg \left(i \leq 0.00015\right):\\
\;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -7.80000000000000043e59 or 1.49999999999999987e-4 < i

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]

    if -7.80000000000000043e59 < i < 1.49999999999999987e-4

    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 t around 0 82.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -7.8 \cdot 10^{+59} \lor \neg \left(i \leq 0.00015\right):\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + b \cdot \log c\right)\\ \end{array} \]

Alternative 15: 42.4% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+87}:\\
\;\;\;\;z + y \cdot i\\

\mathbf{elif}\;z \leq -4.4 \cdot 10^{-46} \lor \neg \left(z \leq -3.9 \cdot 10^{-78}\right):\\
\;\;\;\;a + y \cdot i\\

\mathbf{else}:\\
\;\;\;\;b \cdot \log c\\


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

    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 z around inf 56.5%

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

    if -1.05e87 < z < -4.4000000000000002e-46 or -3.9000000000000002e-78 < z

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

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

    if -4.4000000000000002e-46 < z < -3.9000000000000002e-78

    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 t around 0 66.8%

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

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

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

      \[\leadsto \color{blue}{\log c \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{+87}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-46} \lor \neg \left(z \leq -3.9 \cdot 10^{-78}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;b \cdot \log c\\ \end{array} \]

Alternative 16: 42.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.65 \cdot 10^{+87}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z\right)\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-46} \lor \neg \left(z \leq -3.9 \cdot 10^{-78}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;b \cdot \log c\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (<= z -3.65e+87)
   (fma y i z)
   (if (or (<= z -4.4e-46) (not (<= z -3.9e-78)))
     (+ a (* y i))
     (* b (log c)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if (z <= -3.65e+87) {
		tmp = fma(y, i, z);
	} else if ((z <= -4.4e-46) || !(z <= -3.9e-78)) {
		tmp = a + (y * i);
	} else {
		tmp = b * log(c);
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if (z <= -3.65e+87)
		tmp = fma(y, i, z);
	elseif ((z <= -4.4e-46) || !(z <= -3.9e-78))
		tmp = Float64(a + Float64(y * i));
	else
		tmp = Float64(b * log(c));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -3.65e+87], N[(y * i + z), $MachinePrecision], If[Or[LessEqual[z, -4.4e-46], N[Not[LessEqual[z, -3.9e-78]], $MachinePrecision]], N[(a + N[(y * i), $MachinePrecision]), $MachinePrecision], N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.65 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(y, i, z\right)\\

\mathbf{elif}\;z \leq -4.4 \cdot 10^{-46} \lor \neg \left(z \leq -3.9 \cdot 10^{-78}\right):\\
\;\;\;\;a + y \cdot i\\

\mathbf{else}:\\
\;\;\;\;b \cdot \log c\\


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

    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 z around inf 56.5%

      \[\leadsto \color{blue}{z} + y \cdot i \]
    3. Taylor expanded in z around 0 56.5%

      \[\leadsto \color{blue}{z + i \cdot y} \]
    4. Step-by-step derivation
      1. +-commutative56.5%

        \[\leadsto \color{blue}{i \cdot y + z} \]
      2. *-commutative56.5%

        \[\leadsto \color{blue}{y \cdot i} + z \]
      3. fma-def56.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, z\right)} \]
    5. Simplified56.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, z\right)} \]

    if -3.64999999999999998e87 < z < -4.4000000000000002e-46 or -3.9000000000000002e-78 < z

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

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

    if -4.4000000000000002e-46 < z < -3.9000000000000002e-78

    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 t around 0 66.8%

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

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

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

      \[\leadsto \color{blue}{\log c \cdot b} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification45.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.65 \cdot 10^{+87}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z\right)\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-46} \lor \neg \left(z \leq -3.9 \cdot 10^{-78}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;b \cdot \log c\\ \end{array} \]

Alternative 17: 57.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.9 \cdot 10^{+205} \lor \neg \left(b \leq 1.95 \cdot 10^{+239}\right):\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= b -1.9e+205) (not (<= b 1.95e+239)))
   (* b (log c))
   (fma y i (+ z a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((b <= -1.9e+205) || !(b <= 1.95e+239)) {
		tmp = b * log(c);
	} else {
		tmp = fma(y, i, (z + a));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((b <= -1.9e+205) || !(b <= 1.95e+239))
		tmp = Float64(b * log(c));
	else
		tmp = fma(y, i, Float64(z + a));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[b, -1.9e+205], N[Not[LessEqual[b, 1.95e+239]], $MachinePrecision]], N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision], N[(y * i + N[(z + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{+205} \lor \neg \left(b \leq 1.95 \cdot 10^{+239}\right):\\
\;\;\;\;b \cdot \log c\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.9e205 or 1.9499999999999999e239 < 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 t around 0 99.7%

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

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

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

      \[\leadsto \color{blue}{\log c \cdot b} \]

    if -1.9e205 < b < 1.9499999999999999e239

    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. +-commutative99.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y, i, \color{blue}{\left(\left(\left(x \cdot \log y + t\right) + z\right) + a\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 + t\right) + z\right) + a\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 + t\right) + z\right) + a\right)}\right) \]
      10. associate-+l+99.9%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, i, a + \color{blue}{z}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.9 \cdot 10^{+205} \lor \neg \left(b \leq 1.95 \cdot 10^{+239}\right):\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right)\\ \end{array} \]

Alternative 18: 39.9% accurate, 19.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+246}:\\
\;\;\;\;z\\

\mathbf{elif}\;z \leq -3.1 \cdot 10^{+197} \lor \neg \left(z \leq -4.9 \cdot 10^{+132}\right):\\
\;\;\;\;a + y \cdot i\\

\mathbf{else}:\\
\;\;\;\;z\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.39999999999999994e246 or -3.1e197 < z < -4.9000000000000002e132

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

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

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

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

    if -1.39999999999999994e246 < z < -3.1e197 or -4.9000000000000002e132 < z

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+246}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{+197} \lor \neg \left(z \leq -4.9 \cdot 10^{+132}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]

Alternative 19: 42.9% accurate, 31.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+87}:\\
\;\;\;\;z + y \cdot i\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.59999999999999994e87

    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 z around inf 56.5%

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

    if -3.59999999999999994e87 < z

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

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

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

Alternative 20: 20.8% accurate, 71.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.95 \cdot 10^{+87}:\\
\;\;\;\;z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.9499999999999998e87

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

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

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

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

    if -2.9499999999999998e87 < z

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

      \[\leadsto \color{blue}{a} + y \cdot i \]
    3. Taylor expanded in a around inf 19.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.95 \cdot 10^{+87}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]

Alternative 21: 16.2% 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.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 39.4%

    \[\leadsto \color{blue}{a} + y \cdot i \]
  3. Taylor expanded in a around inf 18.1%

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

    \[\leadsto a \]

Reproduce

?
herbie shell --seed 2023274 
(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)))