Average Error: 0.0 → 0.0
Time: 875.0ms
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[x \cdot 1 + x \cdot \left(-x \cdot 0.5\right)\]
x \cdot \left(1 - x \cdot 0.5\right)
x \cdot 1 + x \cdot \left(-x \cdot 0.5\right)
double f(double x) {
        double r40476 = x;
        double r40477 = 1.0;
        double r40478 = 0.5;
        double r40479 = r40476 * r40478;
        double r40480 = r40477 - r40479;
        double r40481 = r40476 * r40480;
        return r40481;
}

double f(double x) {
        double r40482 = x;
        double r40483 = 1.0;
        double r40484 = r40482 * r40483;
        double r40485 = 0.5;
        double r40486 = r40482 * r40485;
        double r40487 = -r40486;
        double r40488 = r40482 * r40487;
        double r40489 = r40484 + r40488;
        return r40489;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x \cdot \left(1 - x \cdot 0.5\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

    \[\leadsto x \cdot \color{blue}{\left(1 + \left(-x \cdot 0.5\right)\right)}\]
  4. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-x \cdot 0.5\right)}\]
  5. Final simplification0.0

    \[\leadsto x \cdot 1 + x \cdot \left(-x \cdot 0.5\right)\]

Reproduce

herbie shell --seed 2020027 +o rules:numerics
(FPCore (x)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (- 1 (* x 0.5))))