I have a data set returned from yahoo finance api that is formatted like the following:
167.3B
97.719B
1.322B
973.4M
77.8M
I want to only allow one digit after the decimal. I can think of a number of ways to do it but they all seem somewhat cumbersome. Anyone know a best practice?
This will round to the nearest 10th of an integer
You could do:
If $number equaled 5.69 that would return 5.6, but rounding will be more accurate and is considered the best practice.