SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot XandroZ's Avatar
    Join Date
    May 2006
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Precision result

    need to round a result number,by precision;

    Example:
    Math : y=x/1000000; x=5 => y=0.000005,
    but if I do this in java script y=0.00000500001;(not right) ;how do I round a equation by precision to have a math result

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2005
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure exactly if this is what you are looking for, but check out number.toPrecision() and number.toFixed() here
    http://www.hunlock.com/blogs/The_Com...mber_Reference


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •