Performing Math operations on decimal datatype in C#?

前端 未结 5 1107
情深已故
情深已故 2020-11-30 07:27

I was wondering if the above was at all possible. For example:

Math.Sqrt(myVariableHere);

When looking at the overload, it requires a doub

5条回答
  •  迷失自我
    2020-11-30 08:16

    Simple: Cast your decimal to a double and call the function, get the result and cast that back to a decimal. That will probably be faster than any sqrt function you could make on your own, and save a lot of effort.

提交回复
热议问题