That's really odd.  I tried with smaller number and it works as expected.
But the original figures are wrong.  Hmmmm

<cfset xValue = 10.05 />
<cfset yValue = 10.505 />
<cfset newValue = xValue + yValue />
<cfoutput>New Value: #newValue# <br /></cfoutput>
<cfoutput>New Value Numberformat:
#NumberFormat(variables.newValue,'__________.__')# <br /></cfoutput>
<cfset newValue  = 20.555>
<cfoutput>New Value: #newValue# <br /></cfoutput>
<cfoutput>New Value Numberformat:
#NumberFormat(variables.newValue,'__________.__')# <br /></cfoutput>

Perhaps ask on CF-talk and someone can shed some light.

Paul.

-----Original Message-----
From: Kristen Winsor [mailto:[email protected]] 
Sent: Friday, 23 January 2009 9:21 AM
To: cf-newbie
Subject: Cf and Number Format

Hello All:
 
Wondering why the following would happen, when hard coding a value, the
numberFormat() rounds the number as expected
however, when outputting the same value derived from a calculation, the
value is not rounding as expected.
 
Example:
variables. xValue = 8815.05
 
variables.yValue=   881.505
 
 
<cfset variables.newValue = variable.xValue + variable.yValue >
 
variables.newValue is = 9676.555
 
#NumberFormat(variables.newValue,'__________.__')#  Result is 9676.55
 
but 
<cfset variables.newValue  = 9676.555>
#NumberFormat(variables.newValue,'__________.__')#  Result is 9676.56
 
Why would hard coding the same exact value return different result?
 
Thank you
 
Kris




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4315
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to