RoundTo()

Feature requests for future versions of Hollywood can be voiced here
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

RoundTo()

Post by djrikki »

Hi,

Either amend the current Round() function or provide a new function RoundTo().

The new/amended function will allow rounding to a number of decimal places - not just a straight integer round up.

Eg.

value = 21.1234

Round(value, 2) result = 21.12
Round(value, 3) result = 21.123
Round(value) result = 21
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: RoundTo()

Post by PEB »

Try adding this one line to your script:
---
Function p_RoundTo(StartValue, DecimalPlaces) Return(Round(StartValue*10^DecimalPlaces)/10^DecimalPlaces) EndFunction
---

Now if value = 21.1234
p_RoundTo(value, 2) will give you 21.12
p_RoundTo(value, 3) will give you 21.123
p_RoundTo(value) will give you 21
Post Reply