IsNan and IsInf Functions - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26) +---- Forum: SMcNeill (https://qb64phoenix.com/forum/forumdisplay.php?fid=29) +---- Thread: IsNan and IsInf Functions (/showthread.php?tid=1984) |
IsNan and IsInf Functions - SMcNeill - 09-10-2023 If one ever needs to determine if a calculation generates a Nan result or an INF result, they can always use the following little snippet of code: Save as isnan.h: Code: (Select All) #include <stdio.h> And the test code to check for NaN and Inf: Code: (Select All)
Notice the output is: 0 / 0 is NaN but is *not* INF. 1 / 0 is NaN and is also INF. 0 / 1 is neither NaN, nor is it INF. RE: IsNan and IsInf Functions - Dimster - 09-10-2023 Thanks for this Steve. Don't mean to highjack this thread but it also demonstrates the use of different kinds of brackets and I was wondering the correct use of them. They are (), [], and {}. The last one in particular I haven't used at all. RE: IsNan and IsInf Functions - mnrvovrfc - 09-10-2023 Only the rounded ones, that you get pressing `SHIFT+9` and `SHIFT+0` have anything to do with this BASIC dialect. In a few BASIC dialects and other languages, the square brackets is sometimes used like `MID$()` for one character. But not in QB64 at the moment. Don't let yourself confounded by B.A.M., it was Charlie's choice to use other brackets there and only there. |