How to know whether a double value is valid or not??
-
Recently I find that my application always crashs with invalid double floating value, so I want to determine whether a double floating value is valid or not then I can do some extra work to avoid crashes. Can anybody tell me is there any function or method to known whether a floating value is valid or invalid?? Thanks a lot
-
Recently I find that my application always crashs with invalid double floating value, so I want to determine whether a double floating value is valid or not then I can do some extra work to avoid crashes. Can anybody tell me is there any function or method to known whether a floating value is valid or invalid?? Thanks a lot
-
-
Recently I find that my application always crashs with invalid double floating value, so I want to determine whether a double floating value is valid or not then I can do some extra work to avoid crashes. Can anybody tell me is there any function or method to known whether a floating value is valid or invalid?? Thanks a lot
-
ashxly wrote: the result looks like 1.#NF, and no divided by zero exception occurs OK. This makes sense. The error occurs because infinity cannot be truely represented by any numerical value, including floats. You will certainly get a numerical overflow if you try to divide by zero[^]. So I think the cause is not that you have an 'invalid' float value (unlikely), but that you are performing an invalid mathematical action (like dividing by zero).
I Dream of Absolute Zero
-
Recently I find that my application always crashs with invalid double floating value, so I want to determine whether a double floating value is valid or not then I can do some extra work to avoid crashes. Can anybody tell me is there any function or method to known whether a floating value is valid or invalid?? Thanks a lot
-
Recently I find that my application always crashs with invalid double floating value, so I want to determine whether a double floating value is valid or not then I can do some extra work to avoid crashes. Can anybody tell me is there any function or method to known whether a floating value is valid or invalid?? Thanks a lot
Have you looked at
_isnan()
?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow