C中浮点数据类型的范围? [英] Ranges of floating point datatype in C?

查看:21
本文介绍了C中浮点数据类型的范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在看一本C书,讲的是浮点数的范围,作者给出了表格:

I am reading a C book, talking about ranges of floating point, the author gave the table:

Type     Smallest Positive Value  Largest value      Precision
====     =======================  =============      =========
float    1.17549 x 10^-38         3.40282 x 10^38    6 digits
double   2.22507 x 10^-308        1.79769 x 10^308   15 digits

我不知道最小正数列和最大值列中的数字是从哪里来的.

I dont know where the numbers in the columns Smallest Positive and Largest Value come from.

推荐答案

这些数字来自 IEEE-754 标准,它定义了浮点数的标准表示.链接中的维基百科文章 解释了如何在知道位数的情况下达到这些范围用于符号、尾数和指数.

These numbers come from the IEEE-754 standard, which defines the standard representation of floating point numbers. Wikipedia article at the link explains how to arrive at these ranges knowing the number of bits used for the signs, mantissa, and the exponent.

这篇关于C中浮点数据类型的范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆