On Monday, 6 June 2016 at 20:56:04 UTC, Observer wrote:
On Monday, 6 June 2016 at 20:35:26 UTC, Walter Bright wrote:
What I've done, though I know that I won't convince any users of BigDecimal, is use longs and have them represent pennies instead of dollars. Then they're all exact to two places.

I loaned out my copy of TDPL, so I don't have it nearby to
check, but if that's your approach, you need to ensure that
your underlying integral type is *always* 64-bits, not 32-bits.
The reason is that otherwise, you've just limited your apps
to handling a maximum amount of $21,474,836.48.  But banks
can accept checks up to $99,999,999.99 (yes, they do have
a limit, or at least they used to when I was working in that
field).

Silly me, I meant $21,474,836.47, of course.

Reply via email to