You need to sign in to do that
Don't have an account?
Rytom
variable value NaN
Is there a way in APEX to compare a variable to NaN (not a number).
I have some calculations that involve converting values to decibels so there could be cases where the conversion will give me a NaN (converting a negative number to decibels).
I would like to be able to do some checks on whether the converted value is valid or if it is NaN. But whenever I try to use "NaN" in the code it doesn't list it as a valid value, instead thinking I'm trying to use a variable called NaN.
Hello,
I understand you wish to check if the returned value is number or not. You can simply check it with method isNumeric. You can store the boolean value returned from this method in a variable (NaN) and use it for comparison in rest of your code.
Refer: http://developer.force.com/releases/release/Winter13/New+String+Methods