Average Error: 0.0 → 0.0
Time: 10.6s
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 r2171902 = 1.0;
        double r2171903 = a;
        double r2171904 = r2171902 - r2171903;
        double r2171905 = pa;
        double r2171906 = r2171904 * r2171905;
        double r2171907 = pb;
        double r2171908 = r2171903 * r2171907;
        double r2171909 = r2171906 + r2171908;
        return r2171909;
}

double f(double a, double pa, double pb) {
        double r2171910 = a;
        double r2171911 = pb;
        double r2171912 = pa;
        double r2171913 = r2171911 - r2171912;
        double r2171914 = r2171910 * r2171913;
        double r2171915 = 1.0;
        double r2171916 = r2171915 * r2171912;
        double r2171917 = r2171914 + r2171916;
        return r2171917;
}

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