I remember, once upon a time... a bug where we were trying to find the average credit rating (AAA, AA+, AA, etc) of a portfolio of companies.  And we had this issue where, in a simple degenerate case, the average of AA+ and AA+ became AA (AA+ is expected).  In the end, it was an issue of floating point error accounting!  (This was in C++ btw on a probably not-so-familiar platform).<p>TLDR;
floor(13.0) != 13
floor(13.0) == 12<p>Each credit rating was mapped to a integer.  We&#x27;d take the floating point average of all the integers and then floor it.  The integral answer would be used to map back to a credit rating.<p>Let&#x27;s say AA+ was mapped to the number 13.  Well floor( (float(13) + float(13)) &#x2F; 2.0) == 12.  Not 13.<p>That&#x27;s because floating point 13.0 is really 12.99999999999.<p>The fix was to add accounting for floating point error by adding in ULP (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Unit_in_the_last_place" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Unit_in_the_last_place</a>) which in essence tips the representation of 13.0 to 13.00000000001 (or whatever the real number is).