!isNaN(value - 0)

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Wed Mar 25 08:49:53 UTC 2015


Hi Tal,

Thanks for letting us know. There seems to be a problem with 
toNumber(String). I'm investigating the issue.

Regards,
Hannes

Am 2015-03-25 um 01:48 schrieb Tal Liron:
> Hm, actually, something weirder is going on:
>
> isNaN('1.5x') -> true
> isNaN('1.5d') -> false
>
> What is it about "d"? Is it some kind of numerical literal? Again, 
> this is not standard behavior for JavaScript.
>
> On 03/24/2015 07:40 PM, Tal Liron wrote:
>> In most JavaScript engines, this would return true if value is fully 
>> numerical:
>>
>> !isNaN(value - 0)
>>
>> But in Nashorn, it returns true if even if value is a string that 
>> begins with a number. It seems that arithmetic with strings is 
>> working non-standardly in Nashorn.
>



More information about the nashorn-dev mailing list