Bruno Campanini wrote:
> Or, you can use VatType Currency (only four decimals) or Decimal.
Clarification: these require use of VBA. Also, note that the VBA Mod
operator only works with integers (and rounds floating point inputs to
integers before doing the calculation). If the OP had rounded to
integers then the worksheet MOD function would have given the expected
answer, as I previously noted.
> They are not affected by floating point bugs.
To call this a "bug" stretches the definition of "bug". Is it a "bug"
that you cannot write 1/3 exactly as a decimal fraction? If so, a bug
in what? The field of mathematics? The paper? The pencil? You for
eventually stopping?
Decimal data types are not a panacea, they still only offer finite
precision, and so merely change the particular numbers where these kind
of issues occur.
Jerry
Bookmarks