Average Error: 0.3 → 0.4
Time: 3.8m
Precision: 64
Internal precision: 384
\[\begin{array}{l} \mathbf{if}\;a \lt b:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(b + a\right)\right) \cdot \left(a - \left(c - b\right)\right)\right) \cdot \left(a + \left(c - b\right)\right)\right) \cdot \left(c + \left(b - a\right)\right)}}{4.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(a + b\right)\right) \cdot \left(b - \left(c - a\right)\right)\right) \cdot \left(b + \left(c - a\right)\right)\right) \cdot \left(c + \left(a - b\right)\right)}}{4.0}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;a \lt b:\\ \;\;\;\;\frac{\sqrt{{\left(\sqrt{\left(\left(c + \left(b + a\right)\right) \cdot \left(a - \left(c - b\right)\right)\right) \cdot \left(a + \left(c - b\right)\right)}\right)}^2 \cdot \left(c + \left(b - a\right)\right)}}{4.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(a + b\right)\right) \cdot \left(b - \left(c - a\right)\right)\right) \cdot \left(b + \left(c - a\right)\right)\right) \cdot \left(c + \left(a - b\right)\right)}}{4.0}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 0.3

    \[\begin{array}{l} \mathbf{if}\;a \lt b:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(b + a\right)\right) \cdot \left(a - \left(c - b\right)\right)\right) \cdot \left(a + \left(c - b\right)\right)\right) \cdot \left(c + \left(b - a\right)\right)}}{4.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(a + b\right)\right) \cdot \left(b - \left(c - a\right)\right)\right) \cdot \left(b + \left(c - a\right)\right)\right) \cdot \left(c + \left(a - b\right)\right)}}{4.0}\\ \end{array}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt 0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \lt b:\\ \;\;\;\;\frac{\sqrt{\color{blue}{{\left(\sqrt{\left(\left(c + \left(b + a\right)\right) \cdot \left(a - \left(c - b\right)\right)\right) \cdot \left(a + \left(c - b\right)\right)}\right)}^2} \cdot \left(c + \left(b - a\right)\right)}}{4.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\left(\left(c + \left(a + b\right)\right) \cdot \left(b - \left(c - a\right)\right)\right) \cdot \left(b + \left(c - a\right)\right)\right) \cdot \left(c + \left(a - b\right)\right)}}{4.0}\\ \end{array}\]
  4. Removed slow pow expressions

Runtime

Time bar (total: 3.8m) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3052192724 3812927732 3686175817 630908657 2373248591 511094450)'
(FPCore (a b c)
  :name "triangleSorted"
  :pre (and (<= 1 a 9) (<= 1 b 9) (<= 1 c 9) (> (+ a b) (+ c 1e-06)) (> (+ a c) (+ b 1e-06)) (> (+ b c) (+ a 1e-06)) (< a c) (< b c))
  (if (< a b) (/ (sqrt (* (* (* (+ c (+ b a)) (- a (- c b))) (+ a (- c b))) (+ c (- b a)))) 4.0) (/ (sqrt (* (* (* (+ c (+ a b)) (- b (- c a))) (+ b (- c a))) (+ c (- a b)))) 4.0)))