浮点数的秘密.docVIP

  • 0
  • 0
  • 约4.5千字
  • 约 6页
  • 2016-11-29 发布于重庆
  • 举报
浮点数的秘密

本文从一个有趣而诡异的实验开始。为了提高可读性,博主这里做了改写,简化成了以下两段代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include iostream #include string using namespace std; ?? int main() { ????const float x=1.1; ????const float z=1.123; ????float y=x; ????for(int j=0;j++) ????{ ????????y*=x; ????????y/=z; ????????y+=0.1f; ????????y-=0.1f; ????} ????return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include iostream #include string using namespace std; ?? int main() { ????const float x=1.1; ????const float z=1.123; ????float y=x; ????for(int j=0;j++) ????{ ????????y*=x; ?????

文档评论(0)

1亿VIP精品文档

相关文档