**bizu:**

Hi everyone,

I write a little code for getting round number of 4 digits.

Example : 1.23455 -- > 1.2345

1.23456 --> 1.2346

my code is below. Please help me to check this code and tell me if i wrong. And, anyone have a better ideas? Please share it . Thanks

First, what is the variable RoundNumber and what are trying to do with the following IF statement?

```
if (RoundNumber)
{
...
}
```

Second, why do you need to use a string representation of the number? See the following code as an example:

double RoundNumber(double number, int digits) { number = MathRound(number * MathPow(10, digits)); return (number * MathPow(10, -digits)); }

The above code can round a number to the number of decimal digits provided.

Hi everyone,

I write a little code for getting round number of 4 digits.

Example : 1.23455 -- > 1.2345

1.23456 --> 1.2346

my code is below. Please help me to check this code and tell me if i wrong. And, anyone have a better ideas? Please share it . Thanks