Average Error: 0.2 → 0.0
Time: 2.8m
Precision: 64
Internal Precision: 384
\[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.0224831783971646:\\ \;\;\;\;\frac{x}{{1.0}^{3} + {\left(\sqrt{x + 1.0}\right)}^{3}} \cdot \left(1.0 \cdot 1.0 + \left(\sqrt{x + 1.0} \cdot \sqrt{x + 1.0} - 1.0 \cdot \sqrt{x + 1.0}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1.0 \cdot 1.0 - \left(1.0 + x\right)} \cdot \left(1.0 - \sqrt{x + 1.0}\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original0.2
Target0.2
Herbie0.0
\[\frac{x}{1.0 + \sqrt{x + 1.0}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < 1.0224831783971646

    1. Initial program 0.0

      \[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
    2. Using strategy rm
    3. Applied flip3-+0.0

      \[\leadsto \frac{x}{\color{blue}{\frac{{1.0}^{3} + {\left(\sqrt{x + 1.0}\right)}^{3}}{1.0 \cdot 1.0 + \left(\sqrt{x + 1.0} \cdot \sqrt{x + 1.0} - 1.0 \cdot \sqrt{x + 1.0}\right)}}}\]
    4. Applied associate-/r/0.0

      \[\leadsto \color{blue}{\frac{x}{{1.0}^{3} + {\left(\sqrt{x + 1.0}\right)}^{3}} \cdot \left(1.0 \cdot 1.0 + \left(\sqrt{x + 1.0} \cdot \sqrt{x + 1.0} - 1.0 \cdot \sqrt{x + 1.0}\right)\right)}\]

    if 1.0224831783971646 < x

    1. Initial program 0.5

      \[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
    2. Using strategy rm
    3. Applied flip-+0.5

      \[\leadsto \frac{x}{\color{blue}{\frac{1.0 \cdot 1.0 - \sqrt{x + 1.0} \cdot \sqrt{x + 1.0}}{1.0 - \sqrt{x + 1.0}}}}\]
    4. Applied associate-/r/0.6

      \[\leadsto \color{blue}{\frac{x}{1.0 \cdot 1.0 - \sqrt{x + 1.0} \cdot \sqrt{x + 1.0}} \cdot \left(1.0 - \sqrt{x + 1.0}\right)}\]
    5. Applied simplify0.0

      \[\leadsto \color{blue}{\frac{x}{1.0 \cdot 1.0 - \left(1.0 + x\right)}} \cdot \left(1.0 - \sqrt{x + 1.0}\right)\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 2.8m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x)
  :name "Numeric.Log:$clog1p from log-domain-0.10.2.1, B"

  :herbie-target
  (/ x (+ 1.0 (sqrt (+ x 1.0))))

  (/ x (+ 1.0 (sqrt (+ x 1.0)))))