val() changing numbers when validating a numbers only string

Description

I don't know if there is some type of overflow going on something else.

Simple test:

<cfdump var="9175130478268635">
<cfdump var="#val(9175130478268635)#">
<cfabort>

Returns:
9175130478268635
9175130478268636

Test using
<cfdump var="3175130178268635">
<cfdump var="#val(3175130178268635)#">

everything returns fine.

Environment

Lucee 5.1.1.65 using CentOS

Activity

Michael Offner 
11 June 2018 at 13:35

not a bug, limitation of the JVM

Michael Offner 
11 June 2018 at 13:34

This all comes back to the underlaying JVM, numbers in memory are limited in memory and stored as binary.
This is not unexpected behaviour.
Please have in mind that all number in Lucee are handled as doubles (floating point numbers)

This video may gives you more inside on the topic
https://www.youtube.com/watch?v=g7A8OFi1mdU&t=3s

Pothys - MitrahSoft 
22 November 2017 at 11:54

I've analyzed this ticket & confirmed the issue happened on lucee 4.5 & 5 versions. Val() changes number comes from string. It working fine with 15 digit of numbers after that, It's not working as expected. In ACF val('number') return likes below,

But lucee returns a same number as given. I'm not sure about this issue will confirm this. I've trycf link below to reproduce the issue

https://trycf.com/gist/66266d9c636d27d87bcac45177406db4/lucee5?theme=monokai

Won't Do

Details

Assignee

Reporter

Priority

Labels

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

Created 14 November 2017 at 20:08
Updated 26 February 2021 at 08:02
Resolved 11 June 2018 at 13:35