Average Error: 0.0 → 0.0
Time: 10.5s
Precision: 64
\[\left(1 - a\right) \cdot pa + a \cdot pb\]
\[a \cdot \left(pb - pa\right) + 1 \cdot pa\]
\left(1 - a\right) \cdot pa + a \cdot pb
a \cdot \left(pb - pa\right) + 1 \cdot pa
double f(double a, double pa, double pb) {
        double r2146900 = 1.0;
        double r2146901 = a;
        double r2146902 = r2146900 - r2146901;
        double r2146903 = pa;
        double r2146904 = r2146902 * r2146903;
        double r2146905 = pb;
        double r2146906 = r2146901 * r2146905;
        double r2146907 = r2146904 + r2146906;
        return r2146907;
}

double f(double a, double pa, double pb) {
        double r2146908 = a;
        double r2146909 = pb;
        double r2146910 = pa;
        double r2146911 = r2146909 - r2146910;
        double r2146912 = r2146908 * r2146911;
        double r2146913 = 1.0;
        double r2146914 = r2146913 * r2146910;
        double r2146915 = r2146912 + r2146914;
        return r2146915;
}

Error

Bits error versus a

Bits error versus pa

Bits error versus pb

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\left(1 - a\right) \cdot pa + a \cdot pb\]
  2. Using strategy rm
  3. Applied flip-+29.7

    \[\leadsto \color{blue}{\frac{\left(\left(1 - a\right) \cdot pa\right) \cdot \left(\left(1 - a\right) \cdot pa\right) - \left(a \cdot pb\right) \cdot \left(a \cdot pb\right)}{\left(1 - a\right) \cdot pa - a \cdot pb}}\]
  4. Simplified29.7

    \[\leadsto \frac{\left(\left(1 - a\right) \cdot pa\right) \cdot \left(\left(1 - a\right) \cdot pa\right) - \left(a \cdot pb\right) \cdot \left(a \cdot pb\right)}{\color{blue}{pa \cdot \left(1 - a\right) - a \cdot pb}}\]
  5. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{\left(1 \cdot pa + pb \cdot a\right) - a \cdot pa}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{a \cdot \left(pb - pa\right) + 1 \cdot pa}\]
  7. Final simplification0.0

    \[\leadsto a \cdot \left(pb - pa\right) + 1 \cdot pa\]

Reproduce

herbie shell --seed 1 
(FPCore (a pa pb)
  :name "((1.0 - a) * pa) + (a * pb)"
  :precision binary64
  (+ (* (- 1 a) pa) (* a pb)))