Re: Fixed Point Arithmetic

From: David Cressey <cressey73_at_verizon.net>
Date: Fri, 30 Mar 2007 13:52:02 GMT
Message-ID: <6C8Ph.3$ww5.2_at_trndny09>


"Gene Wirchenko" <genew_at_ocis.net> wrote in message news:58rn03pspoga5r87b0v632b4tmug00gq7f_at_4ax.com...
> "David Cressey" <cressey73_at_verizon.net> wrote:
>
> [snip]
>
> >When it comes to the stock market, it depends on the country. AFAIK,
the
> >NYSE still records stock "points" in units of dollars, with binary
> >fractional points like 1/4, 1/32, and the like. The use of decimal FPs
> >with this kind of data will introduce round off problems that would have
> >been avoided with binary floating point numbers.
>
> Try again. Since 10 is evenly divisible by 2, you simply need
> more precision. For example, 1/32 is exactly representable in decimal
> as .03125.
>

Oops. It's my second turn to be embarrassed in just a week.

> [snip]
>
> >Are fixed point numbers a useful from for DBMSes to support?
>
> Of course, since they often deal with such numbers. Currency
> amounts are almost certainly the most common example.

Thanks. I really liked Oracle's Number (X,2) when I first saw it. And I don't really care if the arithmetic is a little slow, as long as it's right.

If you're doing some heavy duty arithmetic, like interplanetary trajectory calculations, don't use the facilities of a DBMS. And learn what you're doing before doing it. Received on Fri Mar 30 2007 - 15:52:02 CEST

Original text of this message