c# - Round number Up to next 0.25 in .Net -
this question has answer here:
- round next quarter 3 answers
how can round decimal (not down) 0.25?
1.26 -> 1.50 1.45 -> 1.50 1.15 -> 1.25 1.00 -> 1.00 1.55 -> 1.75 1.77 -> 2.00 i have tried following function no success.
decimal.round(x * 4, midpointrounding.toeven) / 4
use ceiling method round up:
decimal.ceiling(x * 4m) / 4m
Comments
Post a Comment