convert (long mantissa) and (sbyte exponent) to decimal

流过昼夜 提交于 2019-12-01 06:37:10

There is a constructor of decimal that does pretty much what you want. But it uses the internal representation of decimal, which is different from your representation. The conversion should be pretty simple for numbers with negative exponent, since you can directly translate that into the scale parameter of the constructor. But with positive exponent, I think you will need to do the multiplication by yourself.

Although I have no idea whether it would be actually faster than your code. And it would be certainly much less readable, so your solution might be fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!