社区
C语言
帖子详情
什么叫“truncation from 'const double' to 'float'”?
flashzlm
2004-04-20 11:31:52
我编写了一个程序,其中有两句是:
float x=2.453;
float y=12.496;
结果,编译器指出这两句警告,并说:truncation from 'const double' to 'float'。
请解释一下好吗?我不懂啊
...全文
2365
3
打赏
收藏
什么叫“truncation from 'const double' to 'float'”?
我编写了一个程序,其中有两句是: float x=2.453; float y=12.496; 结果,编译器指出这两句警告,并说:truncation from 'const double' to 'float'。 请解释一下好吗?我不懂啊
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
liushuaiboy
2004-04-23
打赏
举报
回复
为什么我会的问题都有人答了??郁闷~~
thuers
2004-04-22
打赏
举报
回复
学习
yonyon
2004-04-22
打赏
举报
回复
意思是从双精度的常量到浮点型的转换要进行截短
编译器默认2.453是'const double'
而赋值给float就给出警告,即使实际可能在float精度之内
不必理会了
C++课程上机实验常见错误汇集.doc
C++课程上机实验常见错误汇集.doc C++课程上机实验常见错误汇集.doc
C++程序编译中常见错误资料.pdf
C++程序编译中常见错误资料.pdf
C++常见错误及解决方案
C++常见错误及解决方案 利用一些例子分析初学C++者容易出错的地方
Essential C
Stanford CS Educat
ion
Library: A 45 page summary of the C language. Explains all the common features and techniques for the C language. The coverage is pretty quick, so it is most appropriate for someone with some programming background who needs to see how C works. Topics include variables, int types,
float
ing point types, promot
ion
,
tr
unc
at
ion
, operators, con
tr
ol s
tr
uctures (if, while, for), f
unc
t
ion
s, value parameters, reference parameters, s
tr
ucts, pointers, arrays, the pre-processor, and the standard C library f
unc
t
ion
s. (revised 4/2003)
EssentialC
Essential C
C语言
70,020
社区成员
243,263
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章