你怎么写一个无限精度数字类? [英] How do you write an infinite precision number class?

查看:78
本文介绍了你怎么写一个无限精度数字类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!!! Protoman在这里,我需要写一个无限精度数字类

b / c我想计算pi。给我一些示例代码。另外,当我运行我的

程序并计算pi时,我的计算机会冻结b / c它是无限的吗?b $ b精度?感谢您的帮助!

解决方案

您好


Protoman写道:

嗨!!! Protoman在这里,我需要编写一个无限精度数字类
b / c我想计算pi。给我一些示例代码。


给我所有的钱。

另外,当我运行我的
程序并计算pi时,我的电脑会冻结b / c吗'无限精确?谢谢你的帮助!




说真的......

1)你当然想要任意精度,而不是无限精度

2)你一定要自己做功课

3)如果你遇到困难,可以随意提出更具体的问题


祝你好运

Markus


Protoman写道:

嗨!!! Protoman在这里,


很高兴认识你。


我需要写一个无限精确的数字类
b / c我想计算pi。


非sequitur。如果你想计算pi,你只需要使用任意的

精度库。有一些可用,谷歌是你的朋友。


给我一些示例代码。


请求被拒绝:更礼貌。


此外,当我运行我的程序并计算pi时,我的计算机是否会冻结 b / c它的无限精度?


是的,一个无限的精确计算会冻结你的电脑和整个宇宙的整个世界。


说真的,如果你使用高/任意精度库,它将允许你

来指定你想要的精度。然后该程序将运行并且

打印出一个非常准确的pi近似值,否则它将死在你身上。

你的计算机是否在此过程中冻结取决于你的操作

系统以及它如何处理对内存不断增长的饥饿感的程序。


感谢您的帮助!



非常欢迎您。

最好


Kai-Uwe Bux

好的,让我重新说一下:

我想写一个精确的数字等级[我想成为

能够指定数字或位的精度]因为我的合作。不会

购买任何商业类别[采购部门。是cheapskates]。

我们正在为NASA系统编写一个程序。这需要我们将pi计算为
1,000,000,000+位数。不要担心尺寸;它将运行在一个

Cray上。我们还将用它来代替或取代内置的

数字类型。如果你能给我一些示例代码,那就太棒了。

感谢您的帮助。


Hi!!! Protoman here, I need to write an infinite precision number class
b/c I want to compute pi. Give me some sample code. Also, when I run my
program and it computes pi, will my computer freeze b/c it''s infinite
precision? Thanks for the help!

解决方案

Hi

Protoman wrote:

Hi!!! Protoman here, I need to write an infinite precision number class
b/c I want to compute pi. Give me some sample code.
Give me all your money.
Also, when I run my
program and it computes pi, will my computer freeze b/c it''s infinite
precision? Thanks for the help!



Seriously...
1) you certainly want arbitrary precision, not infinite precision
2) you should definitely do your homework on your own
3) if you get stuck, feel free to ask a more specific question

Good luck
Markus


Protoman wrote:

Hi!!! Protoman here,
Hi, pleased to meet you.

I need to write an infinite precision number class
b/c I want to compute pi.
Non sequitur. If you want to compute pi, all you need is to use an arbitrary
precision library. There are some available, and Google is your friend.

Give me some sample code.
Request denied: be more polite.

Also, when I run my program and it computes pi, will my computer freeze
b/c it''s infinite precision?
Yes, an infinite precission calculation will freeze your computer and the
whole universe along with it.

Seriously, if you use a high/arbitrary precision library, it will allow you
to specify the precision you want. Then the program will run and either
print out a highly accurate approximation to pi or it will die on you.
Whether your computer freezes in the process depends on your operating
system and how it handles programs that have an ever growing hunger for
memory.

Thanks for the help!



You are very welcome.
Best

Kai-Uwe Bux


OK, let me rephrase this:
I''d like to write an arbitary precision number class[I''d like to be
able to specify the precision in digits or bits] because my co. won''t
buy any commercial classes[the procurement dept. are cheapskates].
We''re writing a program for a NASA sys. that requires us to calc pi to
1,000,000,000+ digits. Don''t worry about size; it''ll be running on a
Cray. We''re also going to use it to replace or supplant the built in
number types. If you can give me some sample code, that''d be great.
Thanks for the help.


这篇关于你怎么写一个无限精度数字类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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