S
S
Senture2020-09-25 01:29:24
C++ / C#
Senture, 2020-09-25 01:29:24

How to round up a double number?

There is the following code:

return Math.Round((size / 1000) * (width / 1000), 3);

If we substitute 1355 in size, and 700 in width
Then it turns out 0.948 (if with 4 digits, then 0.9485), I need to round such numbers up, i.e. to get 0.949.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Developer, 2020-09-27
@Senture

Math.Ceiling
Math.Floor is
an elementary task.
Think of it as an aptitude test.
PS I will take it into service in order to weed out juniors at the initial stage at interviews

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question