Re: strange "eq" behaviour [message #69769] |
Mon, 15 February 2010 07:44  |
david[4]
Messages: 5 Registered: January 2008
|
Junior Member |
|
|
Is maxx exactly 1.0000???
If you type:
maxx=1.
And then execute all "ifs" . All print "true"
If you type
maxx=1.000000000001
help,maxx
MAXX FLOAT = 1.00000
But now all ifs are wrong except last one, because print and help don't
show the real value of maxx.
Try printing with format.
So the question is, How do you get maxx?
chris wrote:
> Hi folks,
> sometimes it's hard to understand IDL interprets, e.g.:
>
> IDL> print,maxx
> 1.00000
> IDL> help,maxx
> MAXX FLOAT = 1.00000
> IDL> if maxx eq 1. then print, 'true' else print,'wrong'
> wrong
> IDL> if maxx eq 1 then print, 'true' else print,'wrong'
> wrong
> IDL> if maxx eq float(1) then print, 'true' else print,'wrong'
> wrong
> IDL> if maxx eq maxx then print, 'true' else print,'wrong'
> true
> IDL> if maxx[0] eq 1 then print, 'true' else print,'wrong'
> wrong
> IDL> if maxx[0] eq 1. then print, 'true' else print,'wrong'
> wrong
> IDL> if 5 eq 5. then print, 'true' else print,'wrong'
> true
>
>
> What's going wrong here? Has somebody an idea? Is this a bug or a
> feature ;)
> I use IDL 6.4.1 within Windows 7 x64 Pro
>
> Thanks and regards
>
> Chris
>
|
|
|
Re: strange "eq" behaviour [message #69867 is a reply to message #69769] |
Mon, 15 February 2010 07:54  |
rogass
Messages: 200 Registered: April 2008
|
Senior Member |
|
|
Hi David,
maxx is the correlation coefficient of some data series. It should be
exactly 1 if two data vectors are equal - but it isn't - so now I run
into bigger problems with the inbuilt correlate function . Anyway,
thanks for your hint.
CR
|
|
|