IsNumeric(...) & IsValid("numeric", ...) not working for negative exponent notation numbers as strings

Description

There is a difference in behaviour between Lucee and Adobe ColdFusion for IsNumeric(...) and IsValid("numeric", ...) when called on a number expressed with exponent notation as either a value greater or less than zero, for example 2E05 = 200,000 and 0.00000001 = 1E-08.

Under Lucee, the negative exponent notation string is returning false, but true with positive exponent notation string.

Adobe ColdFusion returns true for both positive/negative exponent notation and for both values as a number/string.

Lucee:
IsNumeric(2E05) = true
IsNumeric("2E05") = true
IsNumeric(1E-08) = true
IsNumeric("1E-08") = false

Adobe ColdFusion:
IsNumeric(2E05) = true
IsNumeric("2E05") = true
IsNumeric(1E-08) = true
IsNumeric("1E-08") = true

Fiddle Provided:
https://trycf.com/gist/7ebea1909a02916f02c82f8c491ccc9b/lucee5?theme=cobalt

Activity

Pothys - MitrahSoft 
16 February 2021 at 15:01
(edited)

I changed the status to resolved. This issue was fixed by https://luceeserver.atlassian.net/browse/LDEV-2747#icft=LDEV-2747

Paul Klinkenberg 
10 February 2021 at 09:13

Pothys - MitrahSoft 
13 January 2021 at 14:04

This issue was fixed from 5.3.8.47-SNAPSHOT onwards. could you please check with fixed version and report here back.

Pothys - MitrahSoft 
3 July 2019 at 14:10

I've added a test case & fix and confirmed the issue happened on lucee. This fix solves the above thing you mentioned on the comment & lucee returns true for that argument with + & - signs.

Pull request: https://github.com/lucee/Lucee/pull/710

Ben Reid 
3 July 2019 at 07:26

FYI - the same problem occurs when including the plus sign with a positive exponent notation, which is valid syntax.

Lucee:
IsNumeric(2E+05) = true
IsNumeric("2E+05") = false

Adobe ColdFusion:
IsNumeric(2E+05) = true
IsNumeric("2E+05") = true

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Fix versions

Affects versions

Priority

Created 3 July 2019 at 04:23
Updated 16 February 2021 at 15:03
Resolved 16 February 2021 at 15:01