Web Analytics Made Easy -
StatCounter Help With Javascript - CodingForum


No announcement yet.

Help With Javascript

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help With Javascript


    Recently I got hands on one new tool, the tool uses accounting.js file from accounting.js: JavaScript number and currency formatting library. The library works perfectly, however the issue we are facing is that the number is automatically rounded to 2 decimal places. I need this to be at least 3 decimal places.

    For eg: If i input the value 1.125 it automatically rounds to 1.13, due to this we are facing issues. There is also a demo option in the URL i mentioned above.

    I'm not much of a developer guy. Can some one please suggest a solution here(I have the access to source code & due to limited development knowledge i don't want to change the library)

  • #2
    have you not read the documentation? it explains how to set resp. configure the library to use the desired precision.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


    • #3
      If you are asking about this:

      currency: {
      symbol : "$", // default currency symbol is '$'
      format: "%s%v", // controls output: %s = symbol, %v = value/number (can be object: see below)
      decimal : ".", // decimal point separator
      thousand: ",", // thousands separator
      precision : 2 // decimal places

      I did change the precision to 3, still the result is same.