Average Error: 0.0 → 0.0
Time: 5.2s
Precision: 64
\[0.5 \cdot \left(f \cdot a\right) + 0.5 \cdot \left(f \cdot b\right)\]
\[\left(0.5 \cdot f\right) \cdot \left(b + a\right)\]
0.5 \cdot \left(f \cdot a\right) + 0.5 \cdot \left(f \cdot b\right)
\left(0.5 \cdot f\right) \cdot \left(b + a\right)
double f(double f, double a, double b) {
        double r625350 = 0.5;
        double r625351 = f;
        double r625352 = a;
        double r625353 = r625351 * r625352;
        double r625354 = r625350 * r625353;
        double r625355 = b;
        double r625356 = r625351 * r625355;
        double r625357 = r625350 * r625356;
        double r625358 = r625354 + r625357;
        return r625358;
}

double f(double f, double a, double b) {
        double r625359 = 0.5;
        double r625360 = f;
        double r625361 = r625359 * r625360;
        double r625362 = b;
        double r625363 = a;
        double r625364 = r625362 + r625363;
        double r625365 = r625361 * r625364;
        return r625365;
}

Error

Bits error versus f

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[0.5 \cdot \left(f \cdot a\right) + 0.5 \cdot \left(f \cdot b\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\left(0.5 \cdot f\right) \cdot \left(b + a\right)}\]
  3. Final simplification0.0

    \[\leadsto \left(0.5 \cdot f\right) \cdot \left(b + a\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (f a b)
  :name "0.5f * a + 0.5f * b"
  :precision binary64
  (+ (* 0.5 (* f a)) (* 0.5 (* f b))))