Average Error: 2.3 → 0.1
Time: 4.8s
Precision: 64
\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\]
\[\begin{array}{l} \mathbf{if}\;k \le 1.79597840343059036 \cdot 10^{62}:\\ \;\;\;\;{k}^{m} \cdot \frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{k}, \frac{a}{k}, 99 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{4}} - 10 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{3}}\right)\\ \end{array}\]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\begin{array}{l}
\mathbf{if}\;k \le 1.79597840343059036 \cdot 10^{62}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{k}, \frac{a}{k}, 99 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{4}} - 10 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{3}}\right)\\

\end{array}
double code(double a, double k, double m) {
	return ((double) (((double) (a * ((double) pow(k, m)))) / ((double) (((double) (1.0 + ((double) (10.0 * k)))) + ((double) (k * k))))));
}
double code(double a, double k, double m) {
	double VAR;
	if ((k <= 1.7959784034305904e+62)) {
		VAR = ((double) (((double) pow(k, m)) * ((double) (a / ((double) fma(k, k, ((double) fma(k, 10.0, 1.0))))))));
	} else {
		VAR = ((double) fma(((double) (((double) exp(((double) (-1.0 * ((double) (m * ((double) log(((double) (1.0 / k)))))))))) / k)), ((double) (a / k)), ((double) (((double) (99.0 * ((double) (((double) (a * ((double) exp(((double) (-1.0 * ((double) (m * ((double) log(((double) (1.0 / k)))))))))))) / ((double) pow(k, 4.0)))))) - ((double) (10.0 * ((double) (((double) (a * ((double) exp(((double) (-1.0 * ((double) (m * ((double) log(((double) (1.0 / k)))))))))))) / ((double) pow(k, 3.0))))))))));
	}
	return VAR;
}

Error

Bits error versus a

Bits error versus k

Bits error versus m

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if k < 1.7959784034305904e+62

    1. Initial program 0.1

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\]
    2. Simplified0.1

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\frac{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}{a}}}\]
    3. Using strategy rm
    4. Applied clear-num0.1

      \[\leadsto \frac{{k}^{m}}{\color{blue}{\frac{1}{\frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}}}}\]
    5. Applied associate-/r/0.0

      \[\leadsto \color{blue}{\frac{{k}^{m}}{1} \cdot \frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}}\]
    6. Simplified0.0

      \[\leadsto \color{blue}{{k}^{m}} \cdot \frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}\]

    if 1.7959784034305904e+62 < k

    1. Initial program 7.1

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\]
    2. Simplified7.2

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\frac{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}{a}}}\]
    3. Taylor expanded around inf 7.1

      \[\leadsto \color{blue}{\left(\frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{2}} + 99 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{4}}\right) - 10 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{3}}}\]
    4. Simplified0.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{k}, \frac{a}{k}, 99 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{4}} - 10 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{3}}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \le 1.79597840343059036 \cdot 10^{62}:\\ \;\;\;\;{k}^{m} \cdot \frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{k}, \frac{a}{k}, 99 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{4}} - 10 \cdot \frac{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{3}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020114 +o rules:numerics
(FPCore (a k m)
  :name "Falkner and Boettcher, Appendix A"
  :precision binary64
  (/ (* a (pow k m)) (+ (+ 1 (* 10 k)) (* k k))))