Average Error: 0.0 → 0.0
Time: 5.6s
Precision: 64
\[x \cdot \left(1.0 - x \cdot 0.5\right)\]
\[1.0 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)\]
x \cdot \left(1.0 - x \cdot 0.5\right)
1.0 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)
double f(double x) {
        double r2631736 = x;
        double r2631737 = 1.0;
        double r2631738 = 0.5;
        double r2631739 = r2631736 * r2631738;
        double r2631740 = r2631737 - r2631739;
        double r2631741 = r2631736 * r2631740;
        return r2631741;
}

double f(double x) {
        double r2631742 = 1.0;
        double r2631743 = x;
        double r2631744 = r2631742 * r2631743;
        double r2631745 = 0.5;
        double r2631746 = r2631745 * r2631743;
        double r2631747 = -r2631743;
        double r2631748 = r2631746 * r2631747;
        double r2631749 = r2631744 + r2631748;
        return r2631749;
}

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

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

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

Reproduce

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