From: ptkwt@... (Phil Tomson) Date: 2004-05-13T04:23:53+09:00 Subject: Re: Major Addition Bug? (We have a winner!) In article <10a4scd81rq1le3@corp.supernews.com>, Michael Geary wrote: >Phil Tomson wrote: >> [Floating point imprecision seems] to present a major >> problem if you want to deal with financial figures, for >> example. Are there any workarounds? > >Financial calculations aren't done in floating point. There are various >number formats that are used, but they all boil down to some form of integer >arithmetic. For example, fixed point decimal may be used, where the value >$625.91 is represented as the integer 62591 with a scaling factor of two >decimal places. In other words, the arithmetic is actually done in pennies, >not dollars. > >-Mike > This seems to be the 100,000th post to Ruby-talk (at least the English version). What has our player won? BTW: Yes, doing financial calculations in pennies seems to make a lot of sense. Phil