C# 获取小数点后精确的精度数
我想要获得准确的小数位数,就像我们除以 1/397 一样,它应该返回小数点后最多 99 位的小数位。我在 C# 中尝试过,但它没有让我达到这个准确度级别,它四舍五入到 10 或 12。
I want to get accurate number of decimal places, just like if we divide 1/397, it shoulb return decimal places upto 99 digits after decimal point. I have tried in c# but its not returning me upto this accuracy level, it rounds off to 10 or 12.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
C# 中可用的标准类型提供的精度远低于您要求的精度:
如果您想要比这些类型提供的精度更高那么你就必须考虑使用第三方库。任意精度库的列表(包括几个 C# 库)可以在 wikipedia。
The standard types available in C# offer much less precision than you're asking for:
If you want better precision than these types offer then you'll have to look at using a third-party library. A list of arbitrary-precision libraries (including several for C#) can be found on wikipedia.
您可以从这里使用
BigFloat
:http://www.fractal -landscapes.co.uk/bigint.html它精确到小数点后 250 位。
You can use
BigFloat
from here: http://www.fractal-landscapes.co.uk/bigint.htmlIt is accurate up to 250 digits after decimal point.