Are you storing the data in a float field in the db? Floats are
inherently inaccurate. You should probably use the decimal(x,y) data
type (if you're using SQL server). 

Leon


-----Original Message-----
From: James Smith [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 14, 2006 7:11 AM
To: CF-Talk
Subject: RE: Problems with float

No calculations are being done, I am simply grabing the value from an
XML feed and then doing an SQL insert into the DB.

--
Jay 

> -----Original Message-----
> From: Martin Thorpe [mailto:[EMAIL PROTECTED]
> Sent: 14 August 2006 12:45
> To: CF-Talk
> Subject: Re: Problems with float
> 
> I have had problems with floats before, where the calculations were 
> incorrect.  Wrapping everything with
> val(number) or evaluate(number) sorted it all out for me.
> 
> It was all with calculations that the problems were caused though, 
> returning incorrect numbers.
> 
> cheers
> Martin
> 
> >Interesting issue...
> >
> >I am extracting a price from an XML feed for insertion into
> our local data.
> >The price is returned as a simple float value which I can output to 
> >screen just fine.  Unfortunately when I insert the info into the 
> >database it gets a little messed up.
> >
> >Here are 5 inserted values from a small test run...
> >
> >19.989999999999998
> >15.99
> >9.9900000000000002
> >14.99
> >39.990000000000002
> >
> >As you can see, 2 of them inserted fine but 3 of them got
> inserted with
> >a
> >0.000000000000002 margin of error.  Does anyone know why
> this is happening?
> >
> >FYI: This is going into MSSQL but I get the same problems
> with MySQL so
> >I don't think it is a DB issue.
> >
> >--
> >Jay
> >
> >--
> >No virus found in this outgoing message.
> >Checked by AVG Free Edition.
> >Version: 7.1.405 / Virus Database: 268.10.9/417 - Release Date: 
> >11/08/2006
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249713
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