Back to the month index |
Back to the list index
|
Alvin Starr (alvin@iplink.net)
Wed, 9 Apr 1997 22:52:37 -0400 (EDT)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Rick Bates: "Re: [mSQL] Importing from a file"
- Previous message: Clyde Smith-Stubbs: "Re: [mSQL] Real rounding, precision"
- In reply to: Craig Riter: "[mSQL] Real rounding, precision"
- Next in thread: Joe Brown: "Re: [mSQL] Real rounding, precision"
Date: Wed, 9 Apr 1997 22:52:37 -0400 (EDT) From: Alvin Starr <alvin@iplink.net> Subject: Re: [mSQL] Real rounding, precision Message-Id: <Pine.OSF.3.91.970409224427.21005N-100000@caesar.iplink.net>On Wed, 9 Apr 1997, Vivek Khera wrote:
> Why would you want to use an approximate data type for an exact value?
> Use an INT type and treat the value as cents. Then have your
> application convert the cents to dollars. What you want is a "fixed
> poing" value, not floating point. Using an INT is the closest you'll
> get in mSQL.
The problem is that 2**31 cents is not necsssarly a large enough number is
is only about $20,000,000.00. This problem is compunded when you are
having to deal with currency ammounts that have a smaller unit value like
the yen or pasos. Double precision floating point should give you a
rounding error free range of 2**53 or so bits, a much larger value.
Extreem care needs to be taken though with floating point to make sure
that you have not run into the area where rounding errors start to effect
your caluclations. Also lots of floating point libraries have problems
converting to and from floating point correctly. 1.99999999999999 may be
really close to 2.0 but is not quite the same.
Alvin Starr || voice: (416)493-3325
Interlink Connectivity || fax: (416)493-7974
alvin@iplink.net ||
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: Rick Bates: "Re: [mSQL] Importing from a file"
- Previous message: Clyde Smith-Stubbs: "Re: [mSQL] Real rounding, precision"
- In reply to: Craig Riter: "[mSQL] Real rounding, precision"
- Next in thread: Joe Brown: "Re: [mSQL] Real rounding, precision"