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

Home » Public Forums » archive » Re: 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
Re: Newbie math trouble [message #62627] Mon, 29 September 2008 21:36
Gaurav is currently offline  Gaurav
Messages: 50
Registered: January 2007
Member
Thank you very much. I was also able to locate an old thread on the
newsgroup pointing me to do the same.

Thank you for your consideration.

Gaurav
Re: Newbie math trouble [message #62654 is a reply to message #62627] Mon, 29 September 2008 03:51 Go to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Mon, 29 Sep 2008 00:39:10 -0700 (PDT), Gaurav
<selfishgaurav@gmail.com> wrote:

> 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

http://www.dfanning.com/code_tips/comparearray.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Command line arguments
Next Topic: HDF question - how to make a copy of the structure?

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

Current Time: Wed Oct 08 18:40:31 PDT 2025

Total time taken to generate the page: 0.00585 seconds