c语言中浮点数的舍入错误

c语言中浮点数的舍入错误。

1、

#include <stdio.h>

int main(void)
{
    float a, b;
    
    b = 2.0e20 + 1.0;
    a = b - 2.0e20;
    
    float c, d;
    d = 2.0e5 + 1.0;
    c = d - 2.0e5;
    
    printf("a = %f  
", a);
    printf("c = %f  
", c);
    
    return 0;
}

原文地址:https://www.cnblogs.com/liujiaxin2018/p/15037324.html