Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Rounding a Number up to the Nearest 1000

Keywords:   rounding round up round-up

Question:

Do you have a function, or some sample code, to round by 1000?

Answer:

No function, but here's some code that will do it:
	number = AskLine("Round by 1000", "Enter a number", "")
	whole = number / 1000
	fraction = number mod 1000
	rounded = whole * 1000
	If fraction >= 500 Then rounded = rounded + 1000
	Message("Rounded number", rounded)

Article ID:   W13182
Filename:   Round a Number up to Nearest 1000.txt