Average Error: 0.2 → 0.0
Time: 2.2s
Precision: binary64
\[\frac{x}{1 + \sqrt{x + 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le 0.879524345202128521:\\ \;\;\;\;\frac{x}{1 + \log \left(e^{\sqrt{x + 1}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 \cdot 1 - x\right) - 1} \cdot \left(1 - \sqrt{x + 1}\right)\\ \end{array}\]
\frac{x}{1 + \sqrt{x + 1}}
\begin{array}{l}
\mathbf{if}\;x \le 0.879524345202128521:\\
\;\;\;\;\frac{x}{1 + \log \left(e^{\sqrt{x + 1}}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 \cdot 1 - x\right) - 1} \cdot \left(1 - \sqrt{x + 1}\right)\\

\end{array}
double code(double x) {
	return ((double) (x / ((double) (1.0 + ((double) sqrt(((double) (x + 1.0))))))));
}
double code(double x) {
	double VAR;
	if ((x <= 0.8795243452021285)) {
		VAR = ((double) (x / ((double) (1.0 + ((double) log(((double) exp(((double) sqrt(((double) (x + 1.0))))))))))));
	} else {
		VAR = ((double) (((double) (x / ((double) (((double) (((double) (1.0 * 1.0)) - x)) - 1.0)))) * ((double) (1.0 - ((double) sqrt(((double) (x + 1.0))))))));
	}
	return VAR;
}

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 x < 0.879524345202128521

    1. Initial program 0.0

      \[\frac{x}{1 + \sqrt{x + 1}}\]
    2. Using strategy rm
    3. Applied add-log-exp0.0

      \[\leadsto \frac{x}{1 + \color{blue}{\log \left(e^{\sqrt{x + 1}}\right)}}\]

    if 0.879524345202128521 < x

    1. Initial program 0.5

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 0.879524345202128521:\\ \;\;\;\;\frac{x}{1 + \log \left(e^{\sqrt{x + 1}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 \cdot 1 - x\right) - 1} \cdot \left(1 - \sqrt{x + 1}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020162 
(FPCore (x)
  :name "Numeric.Log:$clog1p from log-domain-0.10.2.1, B"
  :precision binary64
  (/ x (+ 1.0 (sqrt (+ x 1.0)))))