# Delphi/Lazarus: Round Number to the next 10, 100 or 1000

Question by Guest | 2016-01-23 at 13:58

I have already read the tutorial about how to round to a specific number of decimal places in Delphi and Lazarus.

However, I am now interested in rounding before the decimal separator (comma or digit) instead of after it. I mean, I would like to round to the tens, hundreds or thousands digit of a number. For example, I would like to turn 12345 to 12340, 12300 or 12000.

Is there also a function available for that?

## Related Topics

### Delphi/Lazarus: 3 Ways to round a Number to X Decimal Places

Tutorial | 7 Comments

### Delphi/Lazarus: Round Decimal Numbers up, down and normally

Tip | 0 Comments

### Delphi/Lazarus: Function to Round Number to any Position after or before Decimal Point

Tutorial | 0 Comments

### Delphi: Round a number to thousands place (12345678 to 12345000)

Question | 2 Answers

### JavaScript: Round Number - round() not working

Question | 1 Answer

### Delphi: Add leading zeros to a number

Tip | 0 Comments

### PHP: Rounding Numbers

Tutorial | 0 Comments

## Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

## Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.

Yes, that is a function for that and you can even use the same function like you have used for rounding decimal places.

Here is an example:

Depending on whether you are passing a positive or negative value to the function RoundTo, it is rounded before or behind the decimal separator. So, in order to round to ten, you have to pass 1. If you would like to round to hundred, you have to pass 2. Accordingly 3 for the thousands digit.

Important: To make it work, you have to add the unit Math. and if you do not want to use this unit, here are some more ideas to solve this task.

2016-01-23 at 14:14