关于float类型比较的问题

来源:互联网 发布:中英文互译软件 编辑:程序博客网 时间:2024/06/05 11:52

 

http://topic.csdn.net/t/20051015/21/4328916.html

 

 

输出结果是1     0 

3.1415是double类型的,改成   
printf("%d/n",a==3.1415f);   

就是1   1了

 

An   unsuffixed   floating   constant   has   type   double.   If   suffixed   by   the   letter   f   or   F,   it   has   type   float.   If   suffixed   by   the   letter   l   or   L,   it   has   type   long   double.   

原创粉丝点击