Schema

Derek Atkins warlord@MIT.EDU
14 Dec 2000 17:11:57 -0500


David Merrill <dmerrill@lupercalia.net> writes:

> I *still* don't think I understand how the rational numbers work when
> working with stocks. An example or two would help. It seems that the
> denominator value might change based on stock splits and such, for
> example.

If you are dealing with real stocks, then your demoninator will be 1
(as you can only own whole-shares of stock).  If you have a Mutual
Fund, your demoniator may be 100, 1000, 10000, or even 100000,
depending on how many decimal places of accuracy you want.

Consider the gnc_numeric object as a means to represent any arbitrary
fixed-point (decimal) number with an arbitrary fixed-point precision.
The demoninator is just the number 10^N where you want N decimal
places of accuracy.

> The currency situation is actually quite simple, if I understand it
> correctly. But stocks have me confusticated.

It's the same thing.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available