"Rounding" numbers - not exactly normal rounding t

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Prospero
Junior Coder
Posts: 20
Joined: Tue Jun 14, 2005 1:18 am

"Rounding" numbers - not exactly normal rounding t

Post by Prospero » Sun Jul 03, 2005 6:24 am

Hi all,

When one is dealing with large integer numbers, does anyone know of a way to "round" a number to end in 125 or 625?

Example #1:

Let's say the number in question is 452764. The closest option to this would be 452625.

Example #2:

If the number is 873212, the closest option would be 873125.

Cheers,

Prospero

Luciano
Junior Coder
Posts: 31
Joined: Fri Feb 11, 2005 1:10 pm
Location: Ghent, BELGIUM

Post by Luciano » Sun Jul 03, 2005 8:02 am

Hi,

Try this formula.

let>x=452764
let>result={int((%x%+625)/500)*500-375}
message>%result%


Greetings.

Luciano

Prospero
Junior Coder
Posts: 20
Joined: Tue Jun 14, 2005 1:18 am

Post by Prospero » Sun Jul 03, 2005 9:58 am

Luciano,

Many many thanks!

That seems to work perfectly.

Prospero

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts