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

Home » Public Forums » archive » Re: fix(4.70*100) is... 469
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: fix(4.70*100) is... 469 [message #53547 is a reply to message #53544] Thu, 19 April 2007 10:44 Go to previous messageGo to previous message
b_efremova@yahoo.com is currently offline  b_efremova@yahoo.com
Messages: 18
Registered: July 2005
Junior Member
I'll try one more time , see if it works.

Here is my initial statement:
When I handle a floating point number, 470.000
it better stay the same number with the precision I use it.

It may well be 469.99999999999999999999999 and this is
perfectly fine with me if when used with a floating point precision
it is rounded to 470.000

OK, so if I do something, like
converting 470.00 to double, I have no right to complain when
the number I get is 469.99999999999999435462346 with any
arbitrary numbers in the digits exceeding the precision I had
provided.

On the other side, I would expect when I use this number with the
provided precision or lower to matter if I had given the number
470.000 or 469.999.

In short, when converting my number to something of lower precision
like integer
I would expect the number to be rounded.

but the integer of 469.9999 is 469. which is not true.

I also had the wrong assumption that FIX will FIRST round the number
to the precision I'm
working with and THEN truncate.
Now when I think of this, it is not very intellicgent assumption.
Well, I did it.
On the other hand I stilll think that

print,469.9999,format='(i3)'
should be
470

but it is 469 insted.
What is wrong about this assumption of mine?
Cheers
Boryana
[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
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: sparsab, sparsax and complex arrays
Next Topic: Re: idl 6.1 crashes on linux

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

Current Time: Fri Oct 10 15:39:31 PDT 2025

Total time taken to generate the page: 1.20345 seconds