This math scares me

Tim Roberts timr at probo.com
Wed Mar 14 01:08:36 EST 2001


"Werner Schiendl" <ws-news at gmx.at> wrote:
>
>I think Windows supports for a 'Currency' data type with some APIs but never
>used them...

Visual Basic (and products that embed it) does have a Currency data type,
but it is a (clever) hack.  Externally, it looks like a fixed-point value
wherein four decimal places can be stored and manipulated exactly.
Internally, it is just a double precision floating point number, scaled by
10,000.  So, if you do this:

  Dim x As Currency
  x = 1.23

x will actually contain the double precision value 12300.0.  The conversion
routines do the scaling automatically where required.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list