[
https://issues.apache.org/jira/browse/TRINIDAD-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606900#action_12606900
]
Ed Burns commented on TRINIDAD-1124:
------------------------------------
Hello Matthias,
I made the change you suggested to my NumberConverter, but I cannot reproduce
the error you're describing.
Here is my testcase:
Converter converter = application.createConverter("javax.faces.Number");
String stringToConvert = "333.111";
Object obj = converter.getAsObject(getFacesContext(), text,
stringToConvert);
assertTrue(obj instanceof java.lang.Number);
String str = converter.getAsString(getFacesContext(), text, obj);
assertTrue(str.equals(stringToConvert));
The obj I get back is now a BigDecimal, after making your change, however, its
value is still 333.111, not 333.1109999999999899955582804977893829345703125 .
How can I reproduce this?
> numberconverter has issue with bigdecimal
> -----------------------------------------
>
> Key: TRINIDAD-1124
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1124
> Project: MyFaces Trinidad
> Issue Type: Bug
> Reporter: Matthias Weßendorf
> Assignee: Matthias Weßendorf
> Fix For: 1.0.9-core, 1.2.9-core
>
>
> Due to a potential bug in BigDecimal there is a bug, when you use BigDecimal
> with a NumberConverter.
> Like
> <tr:inputText value="#{bean.number}" ...>
> <tr:convertNumber />
> </tr:inputText>
> For instance, when the entered value is "333.111" the actual stored value is
> 333.1109999999999899955582804977893829345703125
> There is a mathematic explanation for that in here:
> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.