memset所有位为零将浮动/加倍为零? [英] memset all bits to zero will let float/double to zero?

查看:126
本文介绍了memset所有位为零将浮动/加倍为零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部

我正在阅读这个小组的常见问题解答。我对此有疑问:
http://www.eskimo.com/~scs/C-faq/q7.31.html


它说:

" ;

p = malloc(m * n);

memset(p,0,m * n);

零填充全部 - bits-zero,因此不保证有用的null

指针值(参见本列表的第5部分)或浮点零值。

"


但是ieee754定义浮点零为全位零。


任何人都可以帮忙解释一下这个吗?


提前致谢。

Hi, All
I am reading FAQ of this group. I have a question about this:
http://www.eskimo.com/~scs/C-faq/q7.31.html

It says:
"
p = malloc(m * n);
memset(p, 0, m * n);
The zero fill is all-bits-zero, and does not therefore guarantee useful null
pointer values (see section 5 of this list) or floating-point zero values.
"

but ieee754 defined float zero to be all-bits-zero.

Anyone can help to explain about this?

Thanks in advance.

推荐答案

文章< ca *********** @ mail.cn99.com> ;,

Zhiqiang Ye< ye ** @ mail.cbi.pku.edu.cn>写道:
In article <ca***********@mail.cn99.com>,
Zhiqiang Ye <ye**@mail.cbi.pku.edu.cn> wrote:
零填充是全位零,因此不保证有用的空指针值(参见本列表第5节)或浮点零点值。
但ieee754定义浮点零为全位零。
The zero fill is all-bits-zero, and does not therefore guarantee useful null
pointer values (see section 5 of this list) or floating-point zero values. but ieee754 defined float zero to be all-bits-zero.




为零。


- Richard



So *if* your C omplementation uses IEEE floating point, the values will
be zero.

-- Richard


Zhiqiang Ye写道:
Zhiqiang Ye wrote:
我正在阅读这个小组的常见问题。我对此有疑问:
http://www.eskimo.com/~scs/C-faq/q7.31.html

它说:
"
p = malloc (m * n);
memset(p,0,m * n);
零填充是全位零,因此不保证有用的空指针值(参见这个列表的第5部分)或浮点零值。
>

但ieee754定义了浮零为全零位。

任何人都可以有助于解释这个吗?
I am reading FAQ of this group. I have a question about this:
http://www.eskimo.com/~scs/C-faq/q7.31.html

It says:
"
p = malloc(m * n);
memset(p, 0, m * n);
The zero fill is all-bits-zero, and does not therefore guarantee useful null
pointer values (see section 5 of this list) or floating-point zero values.
"

but ieee754 defined float zero to be all-bits-zero.

Anyone can help to explain about this?




这是一个疯狂的猜测。


因为IEEE 754支持不是强制性的?因此,你不能,或许,
假设每个编译器都将实现

IEEE 754标准规定的格式。



Here''s a wild guess.

Because IEEE 754 support is not mandatory? Thus you cannot, portably,
assume that every compiler will implement the formats specified by the
IEEE 754 standard.


在< ca *********** @ mail.cn99.com> 志强叶 <叶** @ mail.cbi.pku.edu.cn>写道:
In <ca***********@mail.cn99.com> "Zhiqiang Ye" <ye**@mail.cbi.pku.edu.cn> writes:
我正在阅读这个小组的常见问题。我对此有疑问:
http://www.eskimo.com/~scs/C-faq/q7.31.html

它说:
"
p = malloc (m * n);
memset(p,0,m * n);
零填充是全位零,因此不保证有用的空指针值(参见这个列表的第5部分)或浮点零值。
>

但ieee754定义了浮零为全零位。

任何人都可以有助于解释这个吗?
I am reading FAQ of this group. I have a question about this:
http://www.eskimo.com/~scs/C-faq/q7.31.html

It says:
"
p = malloc(m * n);
memset(p, 0, m * n);
The zero fill is all-bits-zero, and does not therefore guarantee useful null
pointer values (see section 5 of this list) or floating-point zero values.
"

but ieee754 defined float zero to be all-bits-zero.

Anyone can help to explain about this?




C标准并没有说浮点类型*必须*遵循

IEEE-754规格。还有其他浮点表示

其中所有位零并不意味着零。


Dan

-

Dan Pop

DESY Zeuthen,RZ集团

电子邮件: Da*****@ifh.de


这篇关于memset所有位为零将浮动/加倍为零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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