Re: How to test for a vector/matrix of constants? [message #51762 is a reply to message #51761] |
Wed, 06 December 2006 13:26   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Bob Crawford wrote:
> On Dec 6, 3:54 pm, Paul van Delst <Paul.vanDe...@noaa.gov> wrote:
>> I think Bob's solution is the safest since that is the only one that doesn't use the "EQ"
>> operator. Insert the usual reasons here for not wanting to use "EQ" to compare floats.
>
> Paul,
>
> Most of the other suggestions are actually using the EQ on integers
> (array subscript values).
> Lots of interesting approaches.
Well, apart from yours, only one other.
From Allan:
if (where(vector ne vector[0]))[0] eq -1 then print,'all same'
-> potential float comparison.
From Braedley
if n_elements(uniq(array, sort(array))) eq 1 then ;flag it
-> No float comparison
From Lajos
mini=min(array, max=maxi)
if mini eq maxi then ...
-> Potential float comparison
Some of said constant, equal numbers could be more equal than others. :o)
cheers,
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
|
|
|