Average Error: 0.0 → 0.0
Time: 4.0s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[1 \cdot x + \left(x \cdot 0.5\right) \cdot \left(-x\right)\]
x \cdot \left(1 - x \cdot 0.5\right)
1 \cdot x + \left(x \cdot 0.5\right) \cdot \left(-x\right)
double f(double x) {
        double r42554 = x;
        double r42555 = 1.0;
        double r42556 = 0.5;
        double r42557 = r42554 * r42556;
        double r42558 = r42555 - r42557;
        double r42559 = r42554 * r42558;
        return r42559;
}

double f(double x) {
        double r42560 = 1.0;
        double r42561 = x;
        double r42562 = r42560 * r42561;
        double r42563 = 0.5;
        double r42564 = r42561 * r42563;
        double r42565 = -r42561;
        double r42566 = r42564 * r42565;
        double r42567 = r42562 + r42566;
        return r42567;
}

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. Simplified0.0

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

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

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

Reproduce

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