Round up 10th of Decimal

M

Magus

I have 3 numbers that I want to round up to the nearest 10th of a decimal.

9.31318 --> 9.4
8.237935 --> 8.3
2.80162 --> 2.9

I can't figure out how to round up though. I've tried Math.Ceiling but it's only returning the Integer. I'm probably overlooking something very simple, but I would appreciate any help.

Thanks!
 
S

Sonnich Jensen

I have 3 numbers that I want to round up to the nearest 10th of a decimal..

9.31318  --> 9.4
8.237935 --> 8.3
2.80162  --> 2.9

I can't figure out how to round up though. I've tried Math.Ceiling but it's only returning the Integer. I'm probably overlooking something very simple, but I would appreciate any help.

Thanks!

Not sure what you want but:

Math.Round(x, 1);

Math.Ceiling(x*10)/10;

This should at least give a hint of the options
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top