Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    Javascript only has one Number type. Commented Oct 27, 2015 at 13:10
  • I know it has one Number type, but you still have functions like floor() that effectively makes it an int (but not really). Commented Oct 27, 2015 at 13:11
  • You really need to clarify if this is about Java or Javascript... you seem to be using the two terms interchangeably, but they are not the same thing. Commented Oct 27, 2015 at 13:34
  • I think Math.floor() is a misleading example because you'd expect it to convert precision (4.2 -> 4) when in fact it doesn't (4.20000 -> 4.00001). Commented Oct 27, 2015 at 13:48
  • 1
    I know what you mean and before it gets any more confusing: What you are looking for is not part of the language. But you can achieve that with libraries like the one I mentioned in my answer. It allows you to do precision conversions. Commented Oct 27, 2015 at 14:06