Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (decimals)
Viewing all articles
Browse latest Browse all 4

Formatting Decimals

0
0

I've been putting together an app that contains several calculators for medical equations, but one problem I've run into is that when I perform a calculation, the answer that gets spit out is in scientific format with about 15 decimal points (ex. 6.5 becomes 6.500000000000001e1). I'd like to round it to the nearest 2 decimal places. I know there is the Math.round function, but it looks like that rounds to the nearest integer, and the "string extraction" workarounds I've seen posted on the forums don't seem to do the trick either. Can anyone suggest something relatively simple to truncate the unwanted decimal points? Thanks.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images