Average Error: 0.2 → 0.0
Time: 1.5m
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}\]
Target
| Original | 0.2 |
|---|
| Target | 0.2 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
Derivation
- Split input into 2 regimes
if x < 1.0224831783971646
Initial program 0.0
\[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
- Using strategy
rm 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)}}}\]
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
Initial program 0.5
\[\frac{x}{1.0 + \sqrt{x + 1.0}}\]
- Using strategy
rm 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}}}}\]
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)}\]
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)\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
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)))))