Is there a Math API for Pow(decimal, decimal)

后端 未结 6 1786
醉梦人生
醉梦人生 2020-12-13 17:18

Is there a library for decimal calculation, especially the Pow(decimal, decimal) method? I can\'t find any.

It can be free or commercial, either way, as

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 18:19

    Not using decimal. Use double instead. According to this thread, the Math.Pow(double, double) is called directly from CLR.

    How is Math.Pow() implemented in .NET Framework?

    Here is what .NET Framework 4 has (2 lines only)

    [SecuritySafeCritical]
    public static extern double Pow(double x, double y);
    

    64-bit decimal is not native in this 32-bit CLR yet. Maybe on 64-bit Framework in the future?

提交回复
热议问题