问题描述
或者换句话说,是否有等同还会将intmax_t
和%JD
但对于浮点数?
Or put differently, are there equivalents to intmax_t
and %jd
but for floating point numbers?
这已经被问,这里侧问题
- float & double in C99
推荐答案
C11不具有浮点当量将intmax_t(与支持的最大宽度整数类型)。如果未来的Ç定义某种长长double等语言presently没有无缝升级路径。
C11 does not have a floating point equivalents to intmax_t (Integer type with the maximum width supported.). Should C of the future define some sort of long long double, etc. the language presently has no seamless upgrade path to it.
C11 6.11.1.1未来标准化可包括附加的浮点类型,包括那些具有更大的范围,precision或两者比长一倍。确实指向你预想更大的宽度的可能性。
C11 6.11.1.1 "Future standardization may include additional floating-point types, including those with greater range, precision, or both than long double." does point to the possibility of larger widths you envision.
有浮点数的情况有所不同,从有需要的整数。各种处理器多年来(8,16,32,64)和128在地平线上有越来越宽整数宽度。而总浮点的规模已的相对的更稳定(4,8,10,16),precision,范围,编码,四舍五入已经采取了很多FP关心。我怀疑我们将看到一个小数和二进制浮点规范。
The situation for floating-point numbers differs from integers in need. Various processors have had increasingly width integer widths over the years (8,16,32,64) and 128 on the horizon. Whereas gross floating-point size has been relatively more stable (4,8,10,16) , precision, range, encoding, rounding have taken up much FP concern. I suspect we'll see decimal and binary floating point specifications next.
另一个区别是整数生长在一个维度 - 范围。 FP可在范围和precision独立生长,更不用说基地(2,10,16等)的特殊性另请参见IEEE 754的评论。
Another difference is that integers grow in one dimension - range. FP can grow independently in range and precision, not to mention the peculiarities of base (2, 10, 16, etc.) Also see "IEEE 754" comment below.
presently我们有3个:C11 6.2.5.4:浮动
,双击
和长双
。如果你想创建你可以prepare与发言权的变化正向兼容路径的typedef长双Xdouble
,但你可能不得不写了很多包装的像功能 Xdouble氮化硅(Xdouble X);
,prepare许多相当于定义了 DBL_MANT_DIG
, PRIdN
等不小的功夫。
Presently we have 3: C11 6.2.5.4 : float
, double
, and long double
. Should you want to create a forward compatibly path you could prepare for a change with say typedef long double Xdouble
, but then you may be obliged to write a lot of wrapper functions like Xdouble sinX(Xdouble x);
, prepare many equivalent defines to DBL_MANT_DIG
, PRIdN
, etc. No small effort.
这篇关于如何获得的实行最大precision浮点数据类型和printf的说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!