Average Error: 0.0 → 0.0
Time: 12.5s
Precision: 64
\[x \cdot \left(1 - x \cdot 0.5\right)\]
\[1 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)\]
x \cdot \left(1 - x \cdot 0.5\right)
1 \cdot x + \left(0.5 \cdot x\right) \cdot \left(-x\right)
double f(double x) {
        double r3317872 = x;
        double r3317873 = 1.0;
        double r3317874 = 0.5;
        double r3317875 = r3317872 * r3317874;
        double r3317876 = r3317873 - r3317875;
        double r3317877 = r3317872 * r3317876;
        return r3317877;
}

double f(double x) {
        double r3317878 = 1.0;
        double r3317879 = x;
        double r3317880 = r3317878 * r3317879;
        double r3317881 = 0.5;
        double r3317882 = r3317881 * r3317879;
        double r3317883 = -r3317879;
        double r3317884 = r3317882 * r3317883;
        double r3317885 = r3317880 + r3317884;
        return r3317885;
}

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(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))))