comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » floats from strings... duh!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Floats [message #47851 is a reply to message #4362] Wed, 08 March 2006 16:33 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Mark Hadfield wrote:
> Paul Van Delst wrote:
>
>> Sheldon wrote:
>>
>>>
>>> Here is a silly question: Can I define a float array and control how
>>> many decimal places are kept? For example, I want all values to only
>>> have an accuracy to the nearest 100th (20.15 and not 20.154983445).
>>> Kind of like in printing, you know, the f5.2 print definition, but only
>>> for variables and arrrays.
>>
>>
>> May I ask why? Usually this sort of thing is required for printing,
>> but not for regular old storage of numbers.
>
>
> Currency?

Ah, fair enough. But a hasty google reveals that currency calculations are not done at the
cent level - a higher precision is required; for currency conversions (6sigfigs), or in
calculating how much you have to pay when you buy petrol or gas etc, (1000th's seem to be
the common unit.).

Another example I looked at converted 1000 Finnish Markka's to Euros 6 times (conversion
rate to 6sigfig) and added the result (�1024.92). Converting 6000 Finnish Markka's was
�1024.90 A 2 cent difference. That may add up when you're converting lotsa moola lotsa times.

So, it seems to me the only reason you'd need precision to 100th's for currency is for
printing your invoices. :o)

cheers,

paulv

p.s. I can't believe I just read 20 pages from a report from the "EUROPEAN COMMISSION
DIRECTORATE GENERAL II ECONOMIC AND FINANCIAL AFFAIRS Monetary matters". Jeez. :o)
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: matching 2 grids
Next Topic: Solaris 10

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:01:46 PDT 2025

Total time taken to generate the page: 0.06905 seconds