Average Error: 5.8 → 3.6
Time: 21.8s
Precision: 64
Internal Precision: 1344
\[\frac{1}{{\left(1 + x\right)}^{n}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\left(n \cdot x + 1\right) - \frac{1}{2} \cdot \left(n \cdot {x}^{2}\right)} \le 0.00021405454233365702:\\ \;\;\;\;{x}^{\left(-n\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\sqrt[3]{{\left(1 + x\right)}^{n}} \cdot \sqrt[3]{{\left(1 + x\right)}^{n}}\right) \cdot \sqrt[3]{{\left(1 + x\right)}^{n}}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ 1 (- (+ (* n x) 1) (* 1/2 (* n (pow x 2))))) < 0.00021405454233365702

    1. Initial program 14.0

      \[\frac{1}{{\left(1 + x\right)}^{n}}\]
    2. Taylor expanded around inf 31.5

      \[\leadsto \frac{1}{\color{blue}{e^{-1 \cdot \left(n \cdot \log \left(\frac{1}{x}\right)\right)}}}\]
    3. Applied simplify8.1

      \[\leadsto \color{blue}{{x}^{\left(-n\right)}}\]

    if 0.00021405454233365702 < (/ 1 (- (+ (* n x) 1) (* 1/2 (* n (pow x 2)))))

    1. Initial program 1.0

      \[\frac{1}{{\left(1 + x\right)}^{n}}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.0

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt[3]{{\left(1 + x\right)}^{n}} \cdot \sqrt[3]{{\left(1 + x\right)}^{n}}\right) \cdot \sqrt[3]{{\left(1 + x\right)}^{n}}}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 21.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x n)
  :name "1/(1 + x)^n"
  (/ 1 (pow (+ 1 x) n)))