Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Decimal Floating Point (was Re: why still use C?)



[EMAIL PROTECTED] (Dan Pop) writes:
> In <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Gene
> Wirchenko) writes:
> >     That would be nice, too, but what if you need decimal FLOAT?
> 
> What for?  Given the intrinsic nature of floating point, if the base is
> relevant to your application, then you should review the application.
> 
> If the ability of representing $3.11 *exactly* is important, simply do all
> your computing in pennies and the base used by your floating point
> representation no longer matters (only the precision is relevant).

This doesn't work very well if you want to buy a gallon of gasoline.

(In the US, gasoline is priced in dollars per gallon, with 3 digits
after the decimal point; the third digit is almost always 9.  For
example, I recently paid $1.599/gallon.  Back when gasoline was a lot
cheaper, I think the idea was that $0.299 looked less expensive than
$0.30; unfortunately, the tradition has continued.)

Stock prices are also sometimes expressed in fractional cents.

And compound interest is calculated by a set of rules that I don't
pretend to understand.

-- 
Keith Thompson (The_Other_Keith) [EMAIL PROTECTED]  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
(Note new e-mail address)
-- 
comp.lang.c.moderated - moderation address: [EMAIL PROTECTED]



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.