LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 833|回复: 3

infinity 在C中代表什么意思?

[复制链接]
发表于 2006-3-12 14:36:33 | 显示全部楼层 |阅读模式
float toobig = 3.4E38 * 100.0f;

C specifies that toobig gets assigned a special value that stands for [color="red"]infinity and that printf() displays either inf or [color="Red"]infinity (or some variation on that theme) for the value.
发表于 2006-3-12 16:16:06 | 显示全部楼层
无穷(大),这里说3.4E38*100.0这个数值 在C里有特殊含义,就是无穷大。数学里那个横过来的8.

比如:
toobig = 3.4E38*100.0f;
nottoobig = toobig / 3.4E38;
printf("%f, %f\n", toobig, nottoobig);
输出是
inf, inf
因为 toobig=无穷大
回复 支持 反对

使用道具 举报

发表于 2006-3-12 16:16:07 | 显示全部楼层
无穷(大),这里说3.4E38*100.0这个数值 在C里有特殊含义,就是无穷大。数学里那个横过来的8.

比如:
toobig = 3.4E38*100.0f;
nottoobig = toobig / 3.4E38;
printf("%f, %f\n", toobig, nottoobig);
输出是
inf, inf
因为 toobig=无穷大
回复 支持 反对

使用道具 举报

发表于 2006-3-12 17:34:06 | 显示全部楼层
IEEE 754浮点数中规定有无穷大的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表