Wednesday, August 10, 2022

[FIXED] How to round decimal value up to nearest 0.05 value?

Issue

Is there any way to round up decimal value to its nearest 0.05 value in .Net?

Ex:

7.125 -> 7.15

6.66 -> 6.7

If its now available can anyone provide me the algo?


Solution

How about:

Math.Ceiling(myValue * 20) / 20


Answered By - Adam Bellaire
Answer Checked By - David Goodson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.