Average Error: 30.3 → 0.2
Time: 4.8s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)\]
\sqrt{x + 1} - \sqrt{x}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\right)\right)
double f(double x) {
        double r527236 = x;
        double r527237 = 1.0;
        double r527238 = r527236 + r527237;
        double r527239 = sqrt(r527238);
        double r527240 = sqrt(r527236);
        double r527241 = r527239 - r527240;
        return r527241;
}

double f(double x) {
        double r527242 = 1.0;
        double r527243 = 0.0;
        double r527244 = r527242 + r527243;
        double r527245 = x;
        double r527246 = r527245 + r527242;
        double r527247 = sqrt(r527246);
        double r527248 = sqrt(r527245);
        double r527249 = r527247 + r527248;
        double r527250 = r527244 / r527249;
        double r527251 = log1p(r527250);
        double r527252 = expm1(r527251);
        return r527252;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.3
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 30.3

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--30.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 expm1-log1p-u0.2

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

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

Reproduce

herbie shell --seed 2020001 +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)))