tracker issue : CF-4202530

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: CF vs Lucee wrt dateAdd() on numbers larger than max integer

| View in Tracker

Status/Resolution/Reason: Needs Review//

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 05/18/2018

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) /

Priority/Frequency: Normal /

Locale/System: / Windows 10 64 bit

Vote Count: 0

Issue: CF (incorrect) vs Lucee (correct) wrt dateAdd() on numbers larger than max integer

Repro:

<cfscript>
  myNumber1 = 2147483647//CF=java.lang.Integer; Lucee=java.lang.Double
  myNumber2 = 2147483648//CF=java.lang.Long; Lucee=java.lang.Double
  myDate1 = dateAdd("l", 0, myNumber1)
  myDate2 = dateAdd("l", 0, myNumber2)
  
  writeOutput(myDate1 & myNumber1.getClass().getName() & '<br>' & myDate2 & myNumber2.getClass().getName() & '<br>' & (myDate1 < myDate2) & '<br>' & myDate1.compare(myDate2))
</cfscript>

Actual Result CF:
-----------
{ts '5881510-07-10 00:00:00'}
{ts '5877591-03-02 00:00:00'}
NO
1
-----------

Expected Result on CF (and actual result on Lucee):
-----------
{ts '5881510-07-10 00:00:00'}
{ts '5881510-07-11 00:00:00'}
true
-1
-----------

Note: I'm not so concerned w/ needing accuracy in the year 5881510.

Question: Should CF be using java.lang.Double like Lucee? Any other less-edge-casey issues that would arise from CF choosing Long over Double?

Credit also to Sean Corfield.

Attachments:

Comments:

Related thread: https://forums.adobeprerelease.com/coldfusionpr/discussion/414/cf-4202530-cf-vs-lucee-wrt-dateadd-on-numbers-larger-than-max-integer
Comment by Aaron N.
27873 | May 18, 2018 09:24:08 PM GMT