All,

Thank you for the input thus far, the general view is doing equality checking on raw 
float values is a no-no and instead the values should be constrained by rounding or 
something similar before checking for equality.  That would seem to be the answer, 
however I am not calculating the values.  The values come from a column of a table and 
the column states the value as 13.1 - would storing that value in a float variable 
cause the same affect of not quite being the same?

Either way I shall adopt the method of rounding the numbers to .1 before checking, 
thanks to everyone for enlightening me to the wicked world of the float datatype!

Regards,
Colin Henderson

-----Original Message-----
From: Terry McDonnell [mailto:[EMAIL PROTECTED]
Sent: 18 October 2004 11:33
To: [EMAIL PROTECTED]
Subject: RE: MI-L MI-L: Problem with IF statement not evaluating to true


Colin

Is it possibly something to do with the precision of your real numbers,
i.e. how many significant decimal places?  e.g. one may = 13.11111 and
the other 13.11112 - not equal, but only displaying 1 dec place will
suggest they're the same.  If you use the ROUND() function on both vals,
to ensure they're truncated to the same no. sig figs do you still get
the problem?

HTH

Terry McDonnell

-----Original Message-----

All,

I think I may have come across a bug, that or my coding is seriously
suspect! I am trying to evaluate two float variables in an IF statement.
If the two values are the same then I want to perform some operations.
The code is:

If (fDistCheck = fDistLink) Then
        '* Perform some stuff here
End If

This statement is working for all values when it is run, the purpose is
to find a link distance that is equalt to the checking value.  Printing
out the values shows me that when the two are the same the operations
inside the if statement occur - except when both values are equal to
13.1! When the two values equal 13.1 the IF statement does not evaluate
to true and my app goes into an eternal loop.

What is going on? Has anyone come across this situation before?






---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13740



This email and any attachments have been virus checked upon receipt at Ordnance Survey 
and are free of all known viruses.



This email is only intended for the person to whom it is addressed and may contain 
confidential information. If you have received this email in error, please notify the 
sender and delete this email which must not be copied, distributed or disclosed to any 
other person.
Unless stated otherwise, the contents of this email are personal to the writer and do 
not represent the official view of Ordnance Survey. Nor can any contract be formed on 
Ordnance Survey's behalf via email. We reserve the right to monitor emails and 
attachments without prior notice.

Thank you for your cooperation.

Ordnance Survey
Romsey Road
Southampton SO16 4GU
Tel: 023 8079 2000
http://www.ordnancesurvey.co.uk


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 13744

Reply via email to