c++ float能到小数点后多少位

Posted on 2016-07-12 14:38  Jay_L_Z  阅读(3861)  评论(0编辑  收藏  举报

float xiaoshu=0.0000000000000000000000000000000000000000000001;
cout<<"xiaoshu"<<xiaoshu<<endl;
double xiaoshu1=0.0000000000000000000000000000000000000000000001;
cout<<"xiaoshu1"<<xiaoshu1<<endl;

结果分别为0和11e-046

float xiaoshu=0.000000000000000000000000000000000000000000001;
    cout<<"xiaoshu"<<xiaoshu<<endl;
    double xiaoshu1=0.000000000000000000000000000000000000000000001;
    cout<<"xiaoshu1"<<xiaoshu1<<endl;

结果分别为1.4013e-045和11e-45(前后两端代码仅差一个0)