Rounding numbers to the nearest tenth

instead of round to the nearest integer, how to round up to 2 decimal point.

for example:

0.1789234 = 0.20

1 Answer


Multiply the number by 10, round the number and then divide by 10.

round_x = round(10 * x)/10;

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy