Average Error: 29.4 → 0.2
Time: 4.8s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)\]
\sqrt{x + 1} - \sqrt{x}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)
double f(double x) {
        double r487207 = x;
        double r487208 = 1.0;
        double r487209 = r487207 + r487208;
        double r487210 = sqrt(r487209);
        double r487211 = sqrt(r487207);
        double r487212 = r487210 - r487211;
        return r487212;
}

double f(double x) {
        double r487213 = 1.0;
        double r487214 = 0.0;
        double r487215 = r487213 + r487214;
        double r487216 = x;
        double r487217 = r487216 + r487213;
        double r487218 = sqrt(r487217);
        double r487219 = sqrt(r487216);
        double r487220 = r487218 + r487219;
        double r487221 = r487215 / r487220;
        double r487222 = expm1(r487221);
        double r487223 = log1p(r487222);
        return r487223;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.4
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 29.4

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

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}\]
  4. Simplified0.2

    \[\leadsto \frac{\color{blue}{1 + 0}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Using strategy rm
  6. Applied log1p-expm1-u0.2

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)}\]
  7. Final simplification0.2

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough3 from C"
  :precision binary64

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

  (- (sqrt (+ x 1)) (sqrt x)))