nathanpjones / DecimalMath

The math support for Decimal that Microsoft forgot and more.
MIT License
47 stars 13 forks source link

Rounding suggestions #6

Open Corniel opened 4 years ago

Corniel commented 4 years ago

While searching for something unrelated to this repository, I stumbled on it somehow. And as I did something similar in the past (I like the clever idea to use Math.Sqrt() to speed up the Sqrt!) I couldn't resit the temptation to share my decimal rounding implementation: DecimalRound.cs

(Off-topic, I consider adding a math library to Qowaiv, we might join our efforts)

nathanpjones commented 4 years ago

Interesting rounding method and also interesting library you have with Qowaiv. What sorts of projects would you use it with?

Corniel commented 4 years ago

@nathanpjones Projects where you want to apply domain-driven design (to a certain degree). And for me, that is already if you think it has value to decorate a property of a class as Percentage instead of double or decimal, because that is what it is in you use case.

In the case of the rounding, I needed rounding to 10 and 100 for a banking customer, and that was what triggered me to add DecimalRound.