Brian H. said the following on 08/12/2010 10:27 PM: > Notice the 4.54747350886E-013. It appears that cold-fusion is doing > floating point subtraction in this case. I can't believe that in all > my years of CF, I've never ran into this issue. I tried using JavaCast > to Double and BigDouble around all my operands, but no cake. In the > end, I wrapped the operation in PrecisionEvaluate(...) and I get the > correct results. Apparently it uses the Java BigDecimal type. > We use Java BigInteger for calculating future timestamps (in ms -- Unix epoch) in the caching layer because the scientific notation issue.
> Two things that confuse me. Why did casting as BigDouble not n solve > this problem.Why did coldfusion chose "float" as the type, since the > MySQL type was NOT float, it was Decimal(10,2). I did a GetMetaData() > on the query, and the numeric columns have "TypeName" = "DECIMAL" as > they should. > MySQL datatypes and the underlying datatype the your CFML uses may not exactly one to one compatible. There is not "numeric" datatype in Java (which ultimately will be the decider) and so it appears CF used the Java primitive "float" as the Java type. This however is wrong according to the conversion chart for the JDBC driver -- stating the "decimal" in MySQL should be "BigDecimial" in Java: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-conversions.html Base on a couple of comments on Ben Nadel's blog, it looks like the behavior changed to this in CF8+. Could be that they switched the official MySQL driver in that release. It's hard to tell what's going on because CF is a closed source product. .pjf -- You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en ***New URLs as of April 29th, 2010*** SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
