Status/Resolution/Reason: Closed/Withdrawn/AsDesigned
Reporter/Name(from Bugbase): Dave Cordes / Dave Cordes (Dave Cordes)
Created: 03/25/2015
Components: Language
Versions: 11.0
Failure Type: Data Corruption
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Critical / All users will encounter
Locale/System: English / Mac 10.10 64 bit
Vote Count: 0
Problem Description:
I believe I just found a bug with the NumberFormat function but this only happens when you add 2 numbers together and the second number ends in .01 or .99. Yeah I know, really weird right?
Steps to Reproduce:
Say, for example, you have 2 numbers you want to add together the result of which comes to 19.94.
<cfset OrderSubtotal = 15.95>
<cfset OrderShipping = 3.99>
<cfset OrderTotal = OrderSubtotal + OrderShipping>
If you run the NumberFormat function on this number and then run a comparison, you get some strange results.
<cfset OrderTotalFormatted = Trim(NumberFormat(OrderTotal,"999999.99"))>
Order Total = #OrderTotal#
Order Total Formatted = #OrderTotalFormatted#
<cfif OrderTotal NEQ OrderTotalFormatted>
#OrderTotal# - #OrderTotalFormatted# = #OrderTotal-OrderTotalFormatted#
</cfif>
Actual Result:
Order Total = 19.94
Order Total Formatted = 19.94
19.94 - 19.94 = -3.5527136788E-015
Expected Result:
Order Total = 19.94
Order Total Formatted = 19.94
19.94 - 19.94 = 0
Any Workarounds:
There are no workarounds that I know of at the moment.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3959342
External Customer Info:
External Company:
External Customer Name: Dave
External Customer Email:
External Test Config: My Hardware and Environment details:
System Information
Server Details
Server Product ColdFusion
Version 11,0,02,291725
Tomcat Version 7.0.52.0
Edition Enterprise
Operating System Windows Server 2008 R2
OS Version 6.1
Update Level D:/ColdFusion11/cfusion/lib/updates/chf11000002.jar
Adobe Driver Version 5.1.1 (Build 0001)
JVM Details
Java Version 1.7.0_71
Java Vendor Oracle Corporation
Java Vendor URL http://java.oracle.com/
Java Home D:\Java\jdk1.7.0_71\jre
Attachments:
Comments: