Average Error: 0.0 → 0.0
Time: 1.7s
Precision: 64
\[x \cdot \left(1.0 - x \cdot 0.5\right)\]
\[x \cdot 1.0 + \left(-0.5 \cdot x\right) \cdot x\]
x \cdot \left(1.0 - x \cdot 0.5\right)
x \cdot 1.0 + \left(-0.5 \cdot x\right) \cdot x
double f(double x) {
        double r862360 = x;
        double r862361 = 1.0;
        double r862362 = 0.5;
        double r862363 = r862360 * r862362;
        double r862364 = r862361 - r862363;
        double r862365 = r862360 * r862364;
        return r862365;
}

double f(double x) {
        double r862366 = x;
        double r862367 = 1.0;
        double r862368 = r862366 * r862367;
        double r862369 = 0.5;
        double r862370 = r862369 * r862366;
        double r862371 = -r862370;
        double r862372 = r862371 * r862366;
        double r862373 = r862368 + r862372;
        return r862373;
}

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.0 - x \cdot 0.5\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.0

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

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

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

Reproduce

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