c语言中浮点数的上溢

1、c语言中浮点值的上溢

#include <stdio.h>

int main(void)
{
    float test1 = 5.2e4 * 100.0f;
    float test2 = 5.2e40 * 100.0f;  //超出float类型可以表示的范围。
    
    printf("test1: %e.\n", test1);
    printf("test2: %e.\n", test2);
    
    return 0;
}

 

posted @ 2021-07-20 22:00  小鲨鱼2018  阅读(326)  评论(0编辑  收藏  举报