Average Error: 0.0 → 0.0
Time: 2.7s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[1 \cdot x + \left(-x \cdot 0.5\right) \cdot x\]
x \cdot \left(1 - x \cdot 0.5\right)
1 \cdot x + \left(-x \cdot 0.5\right) \cdot x
double f(double x) {
        double r39874 = x;
        double r39875 = 1.0;
        double r39876 = 0.5;
        double r39877 = r39874 * r39876;
        double r39878 = r39875 - r39877;
        double r39879 = r39874 * r39878;
        return r39879;
}

double f(double x) {
        double r39880 = 1.0;
        double r39881 = x;
        double r39882 = r39880 * r39881;
        double r39883 = 0.5;
        double r39884 = r39881 * r39883;
        double r39885 = -r39884;
        double r39886 = r39885 * r39881;
        double r39887 = r39882 + r39886;
        return r39887;
}

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(-x \cdot 0.5\right) \cdot x\]

Reproduce

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