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

Home » Public Forums » archive » double precision?
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: Double precision [message #65789 is a reply to message #49718] Thu, 19 March 2009 05:55 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
plim.dreaming@gmail.com wrote:
> Later in the program I calculate the separation between points (x1,y1)
> (x2,y2)
> And for some of those points the program says that the pairs are the
> same. But they are only the same if they are rounded off, the
> difference often only shows up in the last 2 decimal places.
> ya, i read that link, most of it at least.
> One other thing is: lets say the print out is the issue; a case like
> you pointed out above, then why is it that if I do:
> b=string(num)
> print,b will give me the rounded off number?

as David pointed it out, be careful on how you compare your numbers...
a = 0.1234567890123456d
b = 0.1234567890123456d
print, a eq b
1

b = 0.1234567890123456d + 0.1 - 0.1
print, a eq b
0

Also, I suggest you to print your number value a few times (after
reading, after allocating to pixmag, before comparing it), with the
proper format ...
IDL> c = 100.489418d
IDL> print, c
100.48942
IDL> print, c, format = '(F15.10)'
100.4894180000

Jean
[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
Previous Topic: Re: Mac Widget Limitation?
Next Topic: Re: Span a graph across 2 spaces in a !P.MULTI environment?

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

Current Time: Wed Oct 08 19:23:25 PDT 2025

Total time taken to generate the page: 0.00396 seconds