tracker issue : CF-4202032

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

Mathematical Comparison Error

| View in Tracker

Status/Resolution/Reason: To Fix//BugReVerified

Reporter/Name(from Bugbase): John Bolliger / ()

Created: 04/18/2018

Components: Language

Versions: 2016,11.0

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016,0,05,303689 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Linux RHEL 6.4

Vote Count: 2

Problem Description:  Comparing 0.14*100 to 14 produces a false result.  Any other values would produce a true result as expected (e.g. 0.15*100 == 15)

Steps to Reproduce: Script: if(0.14*100 == 14) { writeOutput("True"); } else { writeOutput("False"); }
Tags: <cfif 0.14*100 eq 14>True<cfelse>False</cfif>

Actual Result:  False

Expected Result:  True

Any Workarounds:  None found.

Attachments:

Comments:

The behavior reported is correct. This logic check fails in below two scenrios: <cfif 0.14*100 eq 14> True<cfelse>False </cfif> <cfif 0.144*100 eq 14.4> True<cfelse>False </cfif> I tried many other combination with different values and they worked fine. This should be fixed.
Comment by Poonam J.
27440 | April 19, 2018 04:46:10 AM GMT
Hi Poonam and John, Workaround is precisionEvaluate()/BigDecimal precision. This issue is related to CF-3429216 and can be resolved by fixing CF-4199506. Thanks!, -Aaron
Comment by Aaron N.
27441 | April 20, 2018 11:56:18 PM GMT
Hi Adobe, I see this is currently "To Fix / BugReVerified". But, what exactly would be the fix? This is a floating point math precision issue. Will the fix be for CF to store decimal values as BigDecimal, for higher precision? If so, then this ticket should be a duplicate of CF-4199506. Thanks!, -Aaron
Comment by Aaron N.
27687 | May 05, 2018 05:37:42 AM GMT
Hello? Adobe.. how can you fix the floating point math issues w/o actually changing CF to store the values as BigDecimal? Can you please describe the planned fix? Thanks!, -Aaron
Comment by Aaron N.
27787 | May 13, 2018 09:53:58 AM GMT