I always do the val() on the set whenever it's got a math operation.

<cfset c = val(a - b) />

Then c will be good from here on.

Greg


On Fri, Jul 25, 2008 at 10:25 PM, James Holmes <[EMAIL PROTECTED]>
wrote:

> Add this to your demo:
>
> Is val(c) EQ val(6.2): #val(c) EQ val(6.2)# <br />
>
> Val() sorts this out for you.
>
> On Sat, Jul 26, 2008 at 4:19 AM, Qasim Rasheed wrote:
> > One of my fellow developer discovered some weird behaviour with
> ColdFusion
> > number manipulation. Here is an example
> >
> > <cfset a = 26.2 />
> > <cfset b = 20 />
> > <cfset c = a - b />
> > <cfoutput>
> > Value of c: #c# <br />
> > Is c EQ 6.2: #c EQ 6.2# <br />
> > ToString on c: #c.toString()# <br />
> > </cfoutput>
> >
> > If you run this piece of code the first value will be 6.2, second will be
> a
> > NO and then toString will result in 6.199999999999999.
> >
> > Isn't this a simple subtraction?
> >
> >
> >
>
> 

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

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309753
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to