Average Error: 2.0 → 0.4
Time: 8.7s
Precision: binary64
\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq -6.682248224536682 \cdot 10^{-299}:\\ \;\;\;\;\frac{a \cdot \left(m \cdot \log k\right) + \left(a + 0.5 \cdot \left(a \cdot \left({m}^{2} \cdot {\log k}^{2}\right)\right)\right)}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{elif}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 0:\\ \;\;\;\;\frac{1}{k \cdot \frac{k}{a \cdot {k}^{m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m} \cdot \left(a \cdot \sqrt{\frac{1}{k \cdot 10 + \left(1 + {k}^{2}\right)}}\right)}{\sqrt{1 + k \cdot \left(k + 10\right)}}\\ \end{array}\]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq -6.682248224536682 \cdot 10^{-299}:\\
\;\;\;\;\frac{a \cdot \left(m \cdot \log k\right) + \left(a + 0.5 \cdot \left(a \cdot \left({m}^{2} \cdot {\log k}^{2}\right)\right)\right)}{1 + k \cdot \left(k + 10\right)}\\

\mathbf{elif}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 0:\\
\;\;\;\;\frac{1}{k \cdot \frac{k}{a \cdot {k}^{m}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \left(a \cdot \sqrt{\frac{1}{k \cdot 10 + \left(1 + {k}^{2}\right)}}\right)}{\sqrt{1 + k \cdot \left(k + 10\right)}}\\

\end{array}
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
(FPCore (a k m)
 :precision binary64
 (if (<=
      (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k)))
      -6.682248224536682e-299)
   (/
    (+
     (* a (* m (log k)))
     (+ a (* 0.5 (* a (* (pow m 2.0) (pow (log k) 2.0))))))
    (+ 1.0 (* k (+ k 10.0))))
   (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))) 0.0)
     (/ 1.0 (* k (/ k (* a (pow k m)))))
     (/
      (* (pow k m) (* a (sqrt (/ 1.0 (+ (* k 10.0) (+ 1.0 (pow k 2.0)))))))
      (sqrt (+ 1.0 (* k (+ k 10.0))))))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
double code(double a, double k, double m) {
	double tmp;
	if (((a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= -6.682248224536682e-299) {
		tmp = ((a * (m * log(k))) + (a + (0.5 * (a * (pow(m, 2.0) * pow(log(k), 2.0)))))) / (1.0 + (k * (k + 10.0)));
	} else if (((a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 0.0) {
		tmp = 1.0 / (k * (k / (a * pow(k, m))));
	} else {
		tmp = (pow(k, m) * (a * sqrt(1.0 / ((k * 10.0) + (1.0 + pow(k, 2.0)))))) / sqrt(1.0 + (k * (k + 10.0)));
	}
	return tmp;
}

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 3 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < -6.6822482245366816e-299

    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{a \cdot {k}^{m}}{1 + k \cdot \left(k + 10\right)}}\]
    3. Taylor expanded around 0 0.9

      \[\leadsto \frac{\color{blue}{a \cdot \left(m \cdot \log k\right) + \left(a + 0.5 \cdot \left(a \cdot \left({m}^{2} \cdot {\log k}^{2}\right)\right)\right)}}{1 + k \cdot \left(k + 10\right)}\]

    if -6.6822482245366816e-299 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 0.0

    1. Initial program 2.9

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{1 + k \cdot \left(k + 10\right)}}\]
    3. Using strategy rm
    4. Applied clear-num_binary64_14413.0

      \[\leadsto \color{blue}{\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a \cdot {k}^{m}}}}\]
    5. Taylor expanded around inf 33.4

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

      \[\leadsto \frac{1}{\color{blue}{k \cdot \frac{k}{a \cdot {k}^{m}}}}\]

    if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{1 + k \cdot \left(k + 10\right)}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt_binary64_14640.2

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{\sqrt{1 + k \cdot \left(k + 10\right)} \cdot \sqrt{1 + k \cdot \left(k + 10\right)}}}\]
    5. Applied associate-/r*_binary64_13860.2

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

      \[\leadsto \frac{\color{blue}{\frac{a}{\sqrt{1 + k \cdot \left(k + 10\right)}} \cdot {k}^{m}}}{\sqrt{1 + k \cdot \left(k + 10\right)}}\]
    7. Taylor expanded around 0 0.4

      \[\leadsto \frac{\color{blue}{\left(a \cdot \sqrt{\frac{1}{10 \cdot k + \left({k}^{2} + 1\right)}}\right)} \cdot {k}^{m}}{\sqrt{1 + k \cdot \left(k + 10\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq -6.682248224536682 \cdot 10^{-299}:\\ \;\;\;\;\frac{a \cdot \left(m \cdot \log k\right) + \left(a + 0.5 \cdot \left(a \cdot \left({m}^{2} \cdot {\log k}^{2}\right)\right)\right)}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{elif}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 0:\\ \;\;\;\;\frac{1}{k \cdot \frac{k}{a \cdot {k}^{m}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m} \cdot \left(a \cdot \sqrt{\frac{1}{k \cdot 10 + \left(1 + {k}^{2}\right)}}\right)}{\sqrt{1 + k \cdot \left(k + 10\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2021058 
(FPCore (a k m)
  :name "Falkner and Boettcher, Appendix A"
  :precision binary64
  (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))