With monday.comâ€™s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.
The above solutions will set all values with .99....
What value do you want if it is whole number i.e. 54.00 ? go to 54.99 ?
Check this if you want 54.00 to remain 54.00
decimal x = 54.01m;
decimal fract = x - Decimal.Truncate(x);
if (fract > 0)
{
x = Decimal.Truncate(x) + 0.99m;
}
You can also use mod to get the remainder and then add the difference from 0.99 to the original total.
Dim val as Double = 53.30
val += 0.99 - Math.Round(val Mod 1, 2)
However, as guru_sami mentioned this will always round up to 0.99. If a value is 53.00 it will become 53.99. If that is not the expected output then you would need something like this:
Dim val As Double = 53.01
If (val Mod 1) > 0 Then
val += 0.99 - Math.Round(val Mod 1, 2)
End If
Not sure why mine didn't work, but go ahead and use one of the other ones. I was just offering another method in case doing it that way made more sense to you and scored me a few points. :)
0
Featured Post
With monday.comâ€™s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.
You can try the following:
Return Math.Ceiling((valel / 1.9) + ((13.95 / 1.9) + (56 + 1.9)) X 9) - 0.01