>Given a specific decimal places, I need to know the nearest number lower that a specified number.
>For example:
>
>Decimal places: 2
>Given number: 51245.54468
>Desired number: 51245.54
>
>Decimal places: 1
>Given number: the same as above
>Desired number: 51245.5
>
>Decimal places: 0
>Given number: the same as above
>Desired number: 51245
>
>What's the shortest code to achieve this?
Certainly not the fastest, but (I believe) one of the shortest:
INT(m.lnNumber*10^m.lnDecimalPlaces)/10^m.lnDecimalPlaces
Also, it won't give you the nearest lower number, but the nearest number closer to zero.
----------------------------------
António Tavares Lopes