Average Error: 0.0 → 0.0
Time: 4.5s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[\left(1 - x \cdot 0.5\right) \cdot x\]
x \cdot \left(1 - x \cdot 0.5\right)
\left(1 - x \cdot 0.5\right) \cdot x
double f(double x) {
        double r34878 = x;
        double r34879 = 1.0;
        double r34880 = 0.5;
        double r34881 = r34878 * r34880;
        double r34882 = r34879 - r34881;
        double r34883 = r34878 * r34882;
        return r34883;
}

double f(double x) {
        double r34884 = 1.0;
        double r34885 = x;
        double r34886 = 0.5;
        double r34887 = r34885 * r34886;
        double r34888 = r34884 - r34887;
        double r34889 = r34888 * r34885;
        return r34889;
}

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. Final simplification0.0

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

Reproduce

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