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

Home » Public Forums » archive » Newbie math trouble
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Newbie math trouble [message #62656] Mon, 29 September 2008 00:39
Gaurav is currently offline  Gaurav
Messages: 50
Registered: January 2007
Member
Dear all,
I am having trouble comparing floating point numbers. I seem to have
seen it solved somewhere in IDL help but I am not able to locate it
today. The following simple snippet illustrates the trouble:

;############################################
bottom_value = 327.3 ; usually a user input
interval = 0.3
start_value = ceil(bottom_value/interval) * interval
;start value will contain the smallest number > bottom_value that is
divisible by interval

print, bottom_value, start_value
if bottom_value ne start_value then print, 'All is not well'
;############################################

this code gives me the output:
327.300, 327.300
All is not well

Clearly all is not well. I believe IDL is trying to compare Double
values instead of Float values. How do I overcome this. Any insight
would be highly appreciated.

Gaurav
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: DUNK DUNK man DUNK women DUNK High man DUNK High women
Next Topic: Re: How can I optimize this?

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

Current Time: Thu Oct 09 21:58:08 PDT 2025

Total time taken to generate the page: 0.72006 seconds