范围与precisionC [英] range vs precisionC

查看:73
本文介绍了范围与precisionC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c的范围和精度有什么区别?另外,如果c

不支持定点数,那么如何增加两个

整数呢?


乍得

What is the difference between range and precision in c? Also, if c
doesn''t support fixed point numbers, how is the addition of two
integers possible?

Chad

推荐答案

" Chad"写道:
"Chad" writes:
c的范围和精度有什么区别?


范围是指在

中表示相同数据的非常大或非常小的数字的能力。说一个double类型的变量,x有时是质子和电子之间的距离,也是从太阳到某个遥远星系的距离。浮点数是实数线上

无穷多点数的近似值;精确度与

有多接近。


见更多:

http://en.wikipedia.org/wiki/Floating_point


您可以通过

检查< float.h>中的常量来找到关于您的特定安装的关键因素。

此外,如果c
不支持不支持定点数,如何增加两个
整数?
What is the difference between range and precision in c?
Range refers to the ability to represent very large or very small numbers in
the same datum. Say a variable of type double, x sometimes was the
distance between a proton and an electron and also the distance from the sun
to some distant galaxy. Floating point numbers are approximations of the
infinite number of points on the real number line; precision has to do with
how good that approximation is.

See this for more:

http://en.wikipedia.org/wiki/Floating_point

You can find the key factoids about your particular installation by
examining the constants in <float.h>
Also, if c
doesn''t support fixed point numbers, how is the addition of two
integers possible?




二进制点直接在最小的右边

重要的二进制数字(位)。如果

不能让你满意,那么工具就可以改进了。



The binary point is taken to be immediately to the right of the least
significant binary digit (bit). The tools are there to improve on that if
that doesn''t please you.


Chad写道:
c的范围和精度有什么区别?另外,如果c
不支持定点数,那么如何增加两个
整数呢?
What is the difference between range and precision in c? Also, if c
doesn''t support fixed point numbers, how is the addition of two
integers possible?




a的范围type是它可以代表的
代表的值的范围。例如,'int''的范围为

至少-32767到+32767,或许更多。


类型的精度是

的粒度,它划分了它的范围。 'int''可以表示

值,精度为一个单位,但不能代表半个单位或十分之一单位的
。对于浮点

类型,粒度随

值的大小而变化,因此习惯上相对于
相对而言精确度比绝对条款:某某多数

数字而不是加号或者那么多。


(不要如果我说那个两个的平方根是2.7182818284590452353602874713527

我做了一个非常精确的声明但是

非常不准确。)


添加整数是可能的,因为C知道

如何添加整数。如果这不是一个令人满意的答案,

你需要更清楚地解释你的疑惑:为什么

你认为定点运算涉及任何方式?


-

Eric Sosman
es ***** @ acm-dot-org.inva lid



The range of a type is the span of values it can
represent. An `int'', for example, has a range of at
least -32767 through +32767, perhaps more.

The precision of a type is the granularity with
which it divides up its range. The `int'' can represent
values to a precision of one unit, but cannot represent
half a unit or a tenth of a unit. For floating-point
types the granularity varies with the magnitude of the
value, so it is customary to state the precision in
relative rather than absolute terms: so-and-so many
digits rather than plus-or-minus so-and-so much.

(Don''t confuse precision with accuracy. If I say that
the square root of two is 2.7182818284590452353602874713527
I have made a statement that is extremely precise but
wildly inaccurate.)

The addition of integers is possible because C knows
how to add integers. If that''s not a satisfactory answer,
you''ll need to explain your doubts more clearly: Why do
you think fixed-point arithmetic is involved in any way?

--
Eric Sosman
es*****@acm-dot-org.invalid


>可以添加整数,因为C知道
> The addition of integers is possible because C knows
如何添加整数。如果那不是一个令人满意的答案,那么你需要更清楚地解释一下你的怀疑:为什么你认为定点算术会以任何方式参与?

-
Eric Sosman
es ***** @ acm-dot-org。 inva lid
how to add integers. If that''s not a satisfactory answer,
you''ll need to explain your doubts more clearly: Why do
you think fixed-point arithmetic is involved in any way?

--
Eric Sosman
es*****@acm-dot-org.invalid




在另一个网站上,我有一个关于将浮点数转换为

二进制和返回的问题。无论如何,在这个讲座中,我有人告诉我

定点和浮点两个不同的东西。这个

是我不知道的。经过一些谷歌搜索后,我看到其他新闻组的一些评论,表示C不支持定点。

因此,问题。


Chad



On another site, I had a question about converting floating point to
binary and back. Anyhow, during this lecture, I had someone tell me
that fixed-point and floating-point where two different things. This
was something I wasn''t aware of. After some googling, I saw some
comments on other newsgroups that said C didn''t support fixed-point.
Hence, the questions.

Chad


这篇关于范围与precisionC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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