Loading ...
Sorry, an error occurred while loading the content.

big decimal in javascript

Expand Messages
  • kshitij_ksk
    any idea if there is any support available for big decimal no.s in javascript? I have found the ECMA specification (ECMA-262) which mentions that it supports
    Message 1 of 2 , May 5, 2008
    • 0 Attachment
      any idea if there is any support available for big decimal no.s in
      javascript?

      I have found the ECMA specification (ECMA-262) which mentions that it
      supports double-precision 64-bit format IEEE 754 values. Refer to
      4.3.20 section of Ecma-262.pdf attached.



      Searching further for IEEE 754 specs, it has been mentioned that the
      finite positive and finite negative numbers furthest from zero
      (represented by the value with 2046 in the Exp field and all 1s in the
      fraction field) are ±1.7976931348623157×10308
      (1.7976931348623157e+308). Refer to the 3.2.2 section of ieee754.pdf
      attached.



      More References –



      http://www.irt.org/script/1031.htm (This link mentions that "As
      JavaScript uses floating-point numbers the accuracy is only assured
      for integers between: -9007199254740992 (-2^53) and 9007199254740992
      (2^53)")

      http://docs.sun.com/source/806-3568/ncg_math.html#513

      http://en.wikipedia.org/wiki/IEEE_754#Double-precision_64_bit
    • kshitij_ksk
      As per the specifications mentioned, only 15 significant digits are accepted in javascript. If number exceeds 15 digits then it is rounded off and presented as
      Message 2 of 2 , May 5, 2008
      • 0 Attachment
        As per the specifications mentioned, only 15 significant digits are
        accepted in javascript. If number exceeds 15 digits then it is rounded
        off and presented as exponential number which will fail in the case of
        high value transactions.

        there is a big decimal library available in Javascript, but size of
        the library and also some limitations makes it not much useful.

        any suggestions?
      Your message has been successfully submitted and would be delivered to recipients shortly.