Find a value in wave

I have a problem with a basic (I supposed) function.
I have a wave like
wave0=(1.2, 13,20,40)
I would like to search a given value in wave0, so I wrote something similar to:

name="wave0"
i=-1
do
i=+1
wave wname=$name
if (wname[i]==value)
print "yes"
endif
while (i<4)

it works fine with integer number but it can't find number with digits. What is it going wrong?
Thanks


I believe the usual response is the problem lies in floating point representation of values. The suggestion is to look for your point within a range of values rather than a single equality...


name="wave0"
variable vTolerance = 0.001    //set your desired tolerance here
i=-1
do
i=+1
wave wname=$name
if (value - vTolerance < wname[i] < value + vTolerance)
print "yes"
endif
while (i<4)


You could also see if built in functions, such as FindLevel, will help.
Numeric precision ambiguity is why the FindValue operation has a tolerance parameter.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.

I had similar problem with my procedure unable to compare variables with decimal points. I used the Function 

BinarySearch(waveName, val)

Also

FindValue [/I=iValue /S=start /T=tolerance /U=uValue /V=rValue /Z] srcWave