09-08-2023, 03:45 PM
My memory is sharp but short. Where a same number is divided by itself the resultant is 1 ( ie 1/1 , 2/2 etc) in keeping with this I'm trying to catch a NAN result and convert it to the value of 1. So NAN doesn't seem to be a numeric nor a string. Is there a way to trap NAN and force a value of 1 ??
Code: (Select All)
a = 0
b = 0
Print
Print
Print " Where a = 0 and b = 0"
Print " a/b = "; a / b
Print " b/a = "; b / a
Result$ = Str$(a / b)
If a / b = nan Or b / a = nan Then
a = 1
b = 1
Print "New Value of a/b = "; a / b
End If
If Result$ = "NAN" Or Result$ = "nan" Then
a = 1
b = 1
Print "New Value of a/b = "; a / b
End If