How can 6e6.5 not numeric?


  • 2
    U

    Input: "6e6.5"
    Output: true
    Expected: false

    It is just 6*10^(6.5). If you type that in Google calculator, it roughly equals to 106.01299131


  • 8
    L

    6*10^6.5 is not a number, it's an expression that is evaluated to 106.01299131

    Using e is only a shorthand to simplify the writing of a number, and can be followed only be a (signed) integer. It does not involve any (mathematical) computation, only shifting the decimal mark.


Log in to reply
 

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