Average Error: 50.5 → 0.7
Time: 31.1s
Precision: 64
Internal Precision: 1344
\[\frac{\log \left(1 + x\right) - x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\log \left(1 + x\right) - x}{x \cdot x} \le -0.01727788935765867:\\ \;\;\;\;\frac{1}{3} \cdot x - \left(\frac{1}{4} \cdot {x}^{2} + \frac{1}{2}\right)\\ \mathbf{if}\;\frac{\log \left(1 + x\right) - x}{x \cdot x} \le 47757139.34678391:\\ \;\;\;\;\frac{\log \left(1 + x\right)}{x \cdot x} - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{3} \cdot x - \left(\frac{1}{4} \cdot {x}^{2} + \frac{1}{2}\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (- (log (+ 1 x)) x) (* x x)) < -0.01727788935765867 or 47757139.34678391 < (/ (- (log (+ 1 x)) x) (* x x))

    1. Initial program 60.9

      \[\frac{\log \left(1 + x\right) - x}{x \cdot x}\]
    2. Taylor expanded around 0 0.6

      \[\leadsto \color{blue}{\frac{1}{3} \cdot x - \left(\frac{1}{4} \cdot {x}^{2} + \frac{1}{2}\right)}\]

    if -0.01727788935765867 < (/ (- (log (+ 1 x)) x) (* x x)) < 47757139.34678391

    1. Initial program 29.8

      \[\frac{\log \left(1 + x\right) - x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied div-sub29.8

      \[\leadsto \color{blue}{\frac{\log \left(1 + x\right)}{x \cdot x} - \frac{x}{x \cdot x}}\]
    4. Applied simplify0.7

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

Runtime

Time bar (total: 31.1s)Debug log

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