Average Error: 0.1 → 0.0
Time: 8.3s
Precision: 64
\[b \lt m\]
\[x \cdot \left(1 - \frac{b}{m}\right)\]
\[1 \cdot x + \left(-\frac{x \cdot b}{m}\right)\]
x \cdot \left(1 - \frac{b}{m}\right)
1 \cdot x + \left(-\frac{x \cdot b}{m}\right)
double f(double x, double b, double m) {
        double r2498871 = x;
        double r2498872 = 1.0;
        double r2498873 = b;
        double r2498874 = m;
        double r2498875 = r2498873 / r2498874;
        double r2498876 = r2498872 - r2498875;
        double r2498877 = r2498871 * r2498876;
        return r2498877;
}

double f(double x, double b, double m) {
        double r2498878 = 1.0;
        double r2498879 = x;
        double r2498880 = r2498878 * r2498879;
        double r2498881 = b;
        double r2498882 = r2498879 * r2498881;
        double r2498883 = m;
        double r2498884 = r2498882 / r2498883;
        double r2498885 = -r2498884;
        double r2498886 = r2498880 + r2498885;
        return r2498886;
}

Error

Bits error versus x

Bits error versus b

Bits error versus m

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x \cdot \left(1 - \frac{b}{m}\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.1

    \[\leadsto x \cdot \color{blue}{\left(1 + \left(-\frac{b}{m}\right)\right)}\]
  4. Applied distribute-lft-in0.1

    \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(-\frac{b}{m}\right)}\]
  5. Simplified0.1

    \[\leadsto \color{blue}{1 \cdot x} + x \cdot \left(-\frac{b}{m}\right)\]
  6. Simplified0.0

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

    \[\leadsto 1 \cdot x + \left(-\frac{x \cdot b}{m}\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (x b m)
  :name "(x * (1.0 - b/m))"
  :precision binary32
  :pre (< b m)
  (* x (- 1 (/ b m))))