[ 
https://issues.apache.org/jira/browse/TRINIDAD-2139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13104665#comment-13104665
 ] 

Yee-Wah Lee commented on TRINIDAD-2139:
---------------------------------------

The Math.round code appears to have been there since the numberConverter was 
first created, it appears to be an overlooked when later fixes were made for 
maxFractionDigits. 

The getRounded call can be removed, since numberToString will take into account 
min/maxFractionDigits.

> Client NumberConverter with type=percent ignores maxfractiondigits when 
> formatting
> ----------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-2139
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2139
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0
>            Reporter: Yee-Wah Lee
>            Priority: Minor
>
> NumberFormat.js contains the following code:
> TrNumberFormat.prototype.percentageToString = function(number)
> {
>   number = number * 100;
>   number = this.getRounded(number);
> ..   number = this.numberToString(number);
> }
> consideration the number of fractionDigits but numberToString later will.
> TrNumberFormat.prototype.getRounded = function(val)
> {
>   val = this.moveDecimalRight(val);
>   val = Math.round(val);
>   val = this.moveDecimalLeft(val);
>   return val;
> }
> Math.round function will round to the nearest integer. With the earlier 
> multiplication to 100, precision is preserved to at most two digits, 
> regardless of the maxFractionDigits attribute.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to