Average Error: 0.0 → 0.0
Time: 1.7s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[\left(1 - x \cdot \frac{1}{2}\right) \cdot x\]
x \cdot \left(1 - x \cdot 0.5\right)
\left(1 - x \cdot \frac{1}{2}\right) \cdot x
double f(double x) {
        double r45642 = x;
        double r45643 = 1.0;
        double r45644 = 0.5;
        double r45645 = r45642 * r45644;
        double r45646 = r45643 - r45645;
        double r45647 = r45642 * r45646;
        return r45647;
}

double f(double x) {
        double r45648 = 1.0;
        double r45649 = x;
        double r45650 = 2.0;
        double r45651 = r45648 / r45650;
        double r45652 = r45649 * r45651;
        double r45653 = r45648 - r45652;
        double r45654 = r45653 * r45649;
        return r45654;
}

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

    \[\leadsto \color{blue}{x \cdot \left(1 - x \cdot \frac{1}{2}\right)}\]
  3. Using strategy rm
  4. Applied sub-neg0.0

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

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

    \[\leadsto \left(1 - x \cdot \frac{1}{2}\right) \cdot x\]

Reproduce

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