WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Number Conversion

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 1999:04:15:16:52:18
Last Updated: 1999:04:15:16:52:18