计算大的浮点数快如0.4 ^亿,,什么想法? [英] Calculating big float number fast like 0.4 ^ 100000000 ,, any ideas?

查看:164
本文介绍了计算大的浮点数快如0.4 ^亿,,什么想法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

埃姆...我有一个问题
我有一定的计算导致超过10 ^ -308(双.NET最大的值)的任何方式解决了我通过一个叫做BIGFLOAT <库这个问题A HREF =htt​​p://www.fractal-landscapes.co.uk/bigint.html相对=nofollow> http://www.fractal-landscapes.co.uk/bigint.html ,

Ehm ... I got a problem I've a certain calculation that result is over 10^-308 (the biggest value in double .net ) any way I solved this problem through a library called BIGFLOAT http://www.fractal-landscapes.co.uk/bigint.html ,

我需要计算像0.4 ^(1000或100000000)需要非常非常长的时间,我没有研究并行或分布式编程问题还什么都但我需要一个解决方案,快速,可以理解为我
我打算在明年6小时交付这个项目! :D

What ever I need to calculate something like 0.4 ^(1000 or 100000000) the problem it takes very very long time I didn't study parallel or distributed programming yet but I need a solution that is fast and understandable for me I'm going to deliver this project in next 6 Hours!! :D

下面的代码:

private BigFloat getBlocking(double k)
    {
        double p1, p2;
        BigFloat p3;
        p3 = new BigFloat(pp);
        p1 = this.P / (double)(k / (double)this.N);
        p2 = Math.Pow((1 - p1), 2);
        p3= new BigFloat(1-p2,pp);
        p3.Pow((int)k);
        return p3;

    }



其中,K为1000,N为1001

where K is 1000 , N is 1001

推荐答案

下载和参考,微软的J#.net库从C#项目 - 这样就可以使用J#的BigDecimal的实施

Download, and reference, the Microsoft J# .NET Library from your C# project - so that you can use J#'s BigDecimal implementation.

请参阅:

任意精度的小数在C#

大十进制:

安装J#运行库(免费):
http://www.microsoft.com/downloads/en/details.aspx?familyid=f72c74b3-ed0e-4af8-ae63-2f0e42501be1&displaylang=en

Install the J# runtime (it's free): http://www.microsoft.com/downloads/en/details.aspx?familyid=f72c74b3-ed0e-4af8-ae63-2f0e42501be1&displaylang=en

Arbitrary精度小数

的http:// geekswithblogs。净/ gyoung /存档/ 2006/05/01 / 76869.aspx

J#重distributables含有非常

BigInteger和BigDecimal的,你可以在你的.NET应用程序直接
采用行之有效的实现只通过引用J#组装
vjslib.dll

的http:/ /download.microsoft.com/download/2/e/9/2e9bde04-3af1-4814-9f1e-733f732369a3/NETMatters0512.exe
讨论这进一步。它也
contins这是
非常有用的一些zip类

The J# re-distributables contain very well tested implementations of BigInteger and BigDecimal that you can use directly in your .NET apps simply by referencing the J# assembly vjslib.dll. http://download.microsoft.com/download/2/e/9/2e9bde04-3af1-4814-9f1e-733f732369a3/NETMatters0512.exe discusses this further. It also contins some Zip classes which are quite useful.

MSDN - BigInteger,以GetFiles的,和更多

虽然你可以在网上搜索找到实现在C#,
C ++中的
多如牛毛,和多种其它语言的,
它可能不是必要的。如果你
不介意在
J#库的依赖,你已经在你
处置大
号实施。事实上,你有两个。在
J#运行时库,vjslib.dll,可作为可再发行
组分
,就像.NET
框架。您可以从
的Visual J#下载下载(它也安装$通过可视
工作室的先决条件B $ B)。以同样的方式,一个C#
或C ++应用程序可以使用
Microsoft.VisualBasic.dll中(可视
Basic运行时库),C#,可视
Basic®的和C ++应用程序可以使用
中的J#运行时库和
无数有趣类是
暴露。

While you can search the Web to find a plethora of implementations in C#, C++, and a variety of other languages, it might not be necessary. If you don't mind taking a dependency on the J# libraries, you already have a big number implementation at your disposal. In fact, you have two. The J# run-time library, vjslib.dll, is available as a redistributable component, just like the .NET Framework. You can download it from Visual J# Downloads (it's also installed as a prerequisite by Visual Studio®). In the same manner that a C# or C++ application can make use of Microsoft.VisualBasic.dll (the Visual Basic run-time library), C#, Visual Basic®, and C++ applications can use the J# run-time library and the numerous interesting classes it exposes.

这篇关于计算大的浮点数快如0.4 ^亿,,什么想法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆