-
Fix a Number
I want to know how can I fix a number? Suppose the out put of an expression is 43.4939393403 I want to remove all the number after the dot (including the dot).
The out put of the expression might be 0.39348309483 or 393493.34349343948. Means the number before the decimal is not fixed. How can I do it?
Thanks in advance.
-
Living Proof
Math.round()
will round up / down to the nearest integer.
I do not know the syntax but you can ???
subtract the 'int' value from the 'float' value
If someone tells you it can't be done,
it's probally because they don't know how.
-
Senior Member
And if you just want to get rid of whatever's after the decimal point, use Math.floor(), which alwasy rounds down.
-
Living Proof
Originally posted by chi-styler
And if you just want to get rid of whatever's after the decimal point, use Math.floor(), which alwasy rounds down.
Nice one.. I knew there was an easier way, but could not for the
life of me remember what it was.
If someone tells you it can't be done,
it's probally because they don't know how.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|