Average Error: 59.7 → 0.4
Time: 12.0s
Precision: 64
\[\sqrt{x - 12} - \sqrt{x}\]
\[\frac{1}{\sqrt{x - 12} + \sqrt{x}} \cdot \left(-12 + \left(x - x\right)\right)\]
\sqrt{x - 12} - \sqrt{x}
\frac{1}{\sqrt{x - 12} + \sqrt{x}} \cdot \left(-12 + \left(x - x\right)\right)
double f(double x) {
        double r40278047 = x;
        double r40278048 = 12.0;
        double r40278049 = r40278047 - r40278048;
        double r40278050 = sqrt(r40278049);
        double r40278051 = sqrt(r40278047);
        double r40278052 = r40278050 - r40278051;
        return r40278052;
}

double f(double x) {
        double r40278053 = 1.0;
        double r40278054 = x;
        double r40278055 = 12.0;
        double r40278056 = r40278054 - r40278055;
        double r40278057 = sqrt(r40278056);
        double r40278058 = sqrt(r40278054);
        double r40278059 = r40278057 + r40278058;
        double r40278060 = r40278053 / r40278059;
        double r40278061 = -12.0;
        double r40278062 = r40278054 - r40278054;
        double r40278063 = r40278061 + r40278062;
        double r40278064 = r40278060 * r40278063;
        return r40278064;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 59.7

    \[\sqrt{x - 12} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--59.2

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

    \[\leadsto \frac{\color{blue}{-12 + \left(x - x\right)}}{\sqrt{x - 12} + \sqrt{x}}\]
  5. Using strategy rm
  6. Applied div-inv0.4

    \[\leadsto \color{blue}{\left(-12 + \left(x - x\right)\right) \cdot \frac{1}{\sqrt{x - 12} + \sqrt{x}}}\]
  7. Final simplification0.4

    \[\leadsto \frac{1}{\sqrt{x - 12} + \sqrt{x}} \cdot \left(-12 + \left(x - x\right)\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x-12) - sqrt(x)"
  (- (sqrt (- x 12)) (sqrt x)))