Reputation: 28158
I am trying to dynamically determine the max value for a chart. If i am inspecting a value of
.434
I need this to round up to the
.5
.
It seems pretty simple and maybe I am overlooking some part of this but i have tried a couple different approaches with underwhelming success. Does anyone know how to always round up with decimal places ?
Upvotes: 2
Views: 1133
Reputation: 1368
double x = 0.434;
int y = (int)Math.Ceiling(x*10);
x = y/10.0;
Upvotes: 9