users@glassfish.java.net

Rounding error for BigDecimal in el-impl.jar

From: <glassfish_at_javadesktop.org>
Date: Tue, 20 Nov 2007 09:34:49 PST

Hi, while using el-impl-1.0.jar in a JSF project, I came up with a rounding error while dealing with a BigDecimal value to be delivered to a bean.
The problems seems to occur in ELSupport.coerceToType(), where a input value such as:

1.234567 (precision 7, scale 6) is returned to the bean as 1.2345669999999999699724639867781661450862884521484375 (precision 0, scale 52).

From a quick look - it appears that a BigDecimal is converted to another BigDecimal through a double value.
[Message sent by forum member 'tomarenz' (tomarenz)]

http://forums.java.net/jive/thread.jspa?messageID=246353