Ever been working on a project that requires Decimal precision, but then stuck because you need to use something from System.Math that would shave off half your precision?
I was in a similar situation several years ago. It made me wonder what it would actually take to implement something like Pow
with a fractional exponent or the trig functions Sin
, Cos
, and Tan
. It turns out that I had everything I needed with the help of sources like Google, Wikipedia (ex), and Wolfram MathWorld.
I adapted what I used in the past and created an open source portable library along with a NuGet package. Check it out and let me know what you think.
On GitHub – DecimalMath – The repo readme also has more details about the library contents.
On NuGet – DecimalMath.DecimalEx
Coming soon is an adaptation of a companion geometry library. It’s only on GitHub right now, but I’ll add it to NuGet when it’s cleaned up and unit tested. If there’s demand, I’ll create a preview package for this as well.