Average Error: 1.8 → 1.3
Time: 27.0s
Precision: 64
\[1 \le a \le 9 \land 1 \le b \le 9 \land 1 \le c \le 9 \land a + b \gt c + 0.01000000000000000020816681711721685132943 \land a + c \gt b + 0.01000000000000000020816681711721685132943 \land b + c \gt a + 0.01000000000000000020816681711721685132943\]
\[\sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - b\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - c\right)}\]
\[\sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(0.5 \cdot \left(\left(a + c\right) - b\right)\right)\right) \cdot \left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}\]
\sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - b\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - c\right)}
\sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(0.5 \cdot \left(\left(a + c\right) - b\right)\right)\right) \cdot \left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}
double f(double a, double b, double c) {
        double r68472 = a;
        double r68473 = b;
        double r68474 = r68472 + r68473;
        double r68475 = c;
        double r68476 = r68474 + r68475;
        double r68477 = 2.0;
        double r68478 = r68476 / r68477;
        double r68479 = r68478 - r68472;
        double r68480 = r68478 * r68479;
        double r68481 = r68478 - r68473;
        double r68482 = r68480 * r68481;
        double r68483 = r68478 - r68475;
        double r68484 = r68482 * r68483;
        double r68485 = sqrt(r68484);
        return r68485;
}

double f(double a, double b, double c) {
        double r68486 = a;
        double r68487 = b;
        double r68488 = r68486 + r68487;
        double r68489 = c;
        double r68490 = r68488 + r68489;
        double r68491 = 2.0;
        double r68492 = r68490 / r68491;
        double r68493 = r68492 - r68486;
        double r68494 = r68492 * r68493;
        double r68495 = 0.5;
        double r68496 = r68486 + r68489;
        double r68497 = r68496 - r68487;
        double r68498 = r68495 * r68497;
        double r68499 = r68494 * r68498;
        double r68500 = r68488 - r68489;
        double r68501 = r68495 * r68500;
        double r68502 = r68499 * r68501;
        double r68503 = sqrt(r68502);
        return r68503;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.8

    \[\sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - b\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - c\right)}\]
  2. Taylor expanded around 0 1.6

    \[\leadsto \sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - b\right)\right) \cdot \color{blue}{\left(\left(0.5 \cdot a + 0.5 \cdot b\right) - 0.5 \cdot c\right)}}\]
  3. Simplified1.6

    \[\leadsto \sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(\frac{\left(a + b\right) + c}{2} - b\right)\right) \cdot \color{blue}{\left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}}\]
  4. Taylor expanded around 0 1.3

    \[\leadsto \sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \color{blue}{\left(\left(0.5 \cdot a + 0.5 \cdot c\right) - 0.5 \cdot b\right)}\right) \cdot \left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}\]
  5. Simplified1.3

    \[\leadsto \sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \color{blue}{\left(0.5 \cdot \left(\left(a + c\right) - b\right)\right)}\right) \cdot \left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}\]
  6. Final simplification1.3

    \[\leadsto \sqrt{\left(\left(\frac{\left(a + b\right) + c}{2} \cdot \left(\frac{\left(a + b\right) + c}{2} - a\right)\right) \cdot \left(0.5 \cdot \left(\left(a + c\right) - b\right)\right)\right) \cdot \left(0.5 \cdot \left(\left(a + b\right) - c\right)\right)}\]

Reproduce

herbie shell --seed 1 
(FPCore (a b c)
  :name "triangle2"
  :precision binary64
  :pre (and (<= 1 a 9) (<= 1 b 9) (<= 1 c 9) (> (+ a b) (+ c 0.0100000000000000002)) (> (+ a c) (+ b 0.0100000000000000002)) (> (+ b c) (+ a 0.0100000000000000002)))
  (sqrt (* (* (* (/ (+ (+ a b) c) 2) (- (/ (+ (+ a b) c) 2) a)) (- (/ (+ (+ a b) c) 2) b)) (- (/ (+ (+ a b) c) 2) c))))