jquery-format icon indicating copy to clipboard operation
jquery-format copied to clipboard

Plugin is rounding decimal numbers value for "large" numbers

Open jsanta opened this issue 9 years ago • 0 comments

Hi. I'm getting some differences in expected value an resulting value. Tried

$.format.number(123456789.36, '#,##0.00')
returns: "123,456,789.36"

and works as expected returning a "123,456,789.36"

Tried

$.format.number(123412365456789.36, '#,##0.00')
returns: "123,412,365,456,789.37"

$.format.number(123456789123456789.99, '#,##0.00')
returns: "123,456,789,123,456,780.00"

$.format.number(99876543212323.69, '#,##0.00');
returns: "99,876,543,212,323.68"

and the return values are clearly different from the expected formatted numbers:

  • "123,412,365,456,789.36"
  • "123,456,789,123,456,789.99"
  • "99,876,543,212,323.69"

(regardless any rounding that has to be made, numbers have to respect their value unless a rounding is really needed).

I hope you can provide a patch for this issue. For the project I'm working on I can make an ugly replacement (based on String comparing), but it won't solve the issue.

Best regards from Chile.

jsanta avatar Oct 20 '14 20:10 jsanta