Average Error: 0.0 → 0.0
Time: 7.6s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[1 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)\]
x \cdot \left(1 - x \cdot 0.5\right)
1 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)
double f(double x) {
        double r2390069 = x;
        double r2390070 = 1.0;
        double r2390071 = 0.5;
        double r2390072 = r2390069 * r2390071;
        double r2390073 = r2390070 - r2390072;
        double r2390074 = r2390069 * r2390073;
        return r2390074;
}

double f(double x) {
        double r2390075 = 1.0;
        double r2390076 = x;
        double r2390077 = r2390075 * r2390076;
        double r2390078 = 0.5;
        double r2390079 = r2390078 * r2390076;
        double r2390080 = -r2390076;
        double r2390081 = r2390079 * r2390080;
        double r2390082 = r2390077 + r2390081;
        return r2390082;
}

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-rgt-in0.0

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

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

Reproduce

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