[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How do I round number to x decimal places eg to round 12.50000009 to 12.5
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 13 Mar 2003 08:18:45 -0300
>>How do I round number to x decimal places eg to round 12.50000009 to
>>12.5?
>
>Easy! Multiply the number by a power of 10 to get all of the digits you
>want to keep above the decimal point. Truncate it to an integer. Then
>divide to get everything back where it started
Or use format("%."..digits.."f",x).
--lhf