Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with NAN
#6
(09-08-2023, 06:06 PM)Dimster Wrote: Would this be a success trap for NAN. ...
That won't work because NaN is "falsey", in an expression like that it turns into a false value. You could use this with `Int()` to turn NaN into zero and do some comparisons, but it would get pretty messy.

Not to repeat myself, but you can do it like this, it looks silly but it does work Tongue

```
a = 0
b = 0
ret = a / b

If ret <> ret Then
    ' NaN is the only value that does not equal itself
    ret = 1
End If

Print ret
```
Reply


Messages In This Thread
Working with NAN - by Dimster - 09-08-2023, 03:45 PM
RE: Working with NAN - by DSMan195276 - 09-08-2023, 03:57 PM
RE: Working with NAN - by mnrvovrfc - 09-08-2023, 04:03 PM
RE: Working with NAN - by Dimster - 09-08-2023, 06:06 PM
RE: Working with NAN - by mnrvovrfc - 09-08-2023, 06:22 PM
RE: Working with NAN - by DSMan195276 - 09-08-2023, 07:43 PM
RE: Working with NAN - by Dimster - 09-09-2023, 01:42 PM
RE: Working with NAN - by DSMan195276 - 09-09-2023, 02:31 PM
RE: Working with NAN - by Dimster - 09-09-2023, 03:48 PM
RE: Working with NAN - by SMcNeill - 09-09-2023, 05:03 PM
RE: Working with NAN - by Dimster - 09-09-2023, 06:48 PM
RE: Working with NAN - by SMcNeill - 09-09-2023, 07:11 PM
RE: Working with NAN - by SMcNeill - 09-09-2023, 07:26 PM
RE: Working with NAN - by SMcNeill - 09-09-2023, 08:15 PM
RE: Working with NAN - by grymmjack - 09-10-2023, 12:24 AM
RE: Working with NAN - by eoredson - 09-15-2023, 03:03 AM



Users browsing this thread: 3 Guest(s)