Average Error: 0.0 → 0.0
Time: 6.4s
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 r3211971 = x;
        double r3211972 = 1.0;
        double r3211973 = 0.5;
        double r3211974 = r3211971 * r3211973;
        double r3211975 = r3211972 - r3211974;
        double r3211976 = r3211971 * r3211975;
        return r3211976;
}

double f(double x) {
        double r3211977 = 1.0;
        double r3211978 = x;
        double r3211979 = r3211977 * r3211978;
        double r3211980 = 0.5;
        double r3211981 = r3211980 * r3211978;
        double r3211982 = -r3211978;
        double r3211983 = r3211981 * r3211982;
        double r3211984 = r3211979 + r3211983;
        return r3211984;
}

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 2019158 
(FPCore (x)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
  (* x (- 1.0 (* x 0.5))))