Why the expected return value of -788f is false?


  • 0
    Y

    I checked the testcode source code, the expected return value for -788f and 959440.94f are both false. why?


  • 0
    M

    While the use of an f at the end of a number can mean that it is a float, it also means the f isn't part of the number. In that case, the f is metadata about the number's representation. With the numbers -788f and 959440.94f, however, the f is being treated as part of the number string, which means that the string isn't numeric.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.