ç浮点数字符号 [英] C floating point number notation
问题描述
我注意到,这code编译,但我不知道为什么:
I noticed that this code compiles but I have no idea why:
int main() {
double z = 0.000000000000001E-383DD;
}
但我不知道是什么 DD
在号码的最后手段。我已经通过的标准看,但有没有这方面的记载。
But I'm not sure what the DD
at the end of the number means. I've looked through the standard but there's no mention of this.
我从下面的命令这个数字:
I got this number from the following command:
$ gcc -dM -E - < /dev/null
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
...
也许这是一个GCC扩展?
Might this be a GCC extension?
推荐答案
Right it's a GCC extension to indicate 64-bit decimal floating point literals.
其他扩展后缀:
-
复数文字的,例如
1.0i
,1.0J
,1.0fi
等。这纯粹是一个GCC扩展和C99标准的方法是使用宏I
(1.0 * I
,1.0F * I
等)
Complex literals, e.g.
1.0i
,1.0j
,1.0fi
, etc. This purely a GCC extension and the standard C99 way is to use the macroI
(1.0*I
,1.0f*I
, etc.)
其他浮点类型,这是一个纯粹的GCC扩展:
Additional floating point types, which are purely a GCC extension:
-
1.0瓦特
→__ float80
(80位二进制浮点) -
1.0q
→__ float128
(128位二进制浮点)
1.0w
→__float80
(80-bit binary floating point)1.0q
→__float128
(128-bit binary floating point)
十进制浮点类型,这是基于对提案的 N1312:扩展编程语言C到小数点支持浮点运算的:
Decimal floating point types, which is based on the proposal N1312: Extension for the programming language C to support decimal floating-point arithmetic:
-
1.0df
→_Decimal32
(32位十进制浮点) -
1.0dd
→_Decimal64
(64位十进制浮点) -
1.0dl
→_Decimal128
(128位十进制浮点)
1.0df
→_Decimal32
(32-bit decimal floating point)1.0dd
→_Decimal64
(64-bit decimal floating point)1.0dl
→_Decimal128
(128-bit decimal floating point)
定点类型的,这是基于对提案的 N1169:扩展支持嵌入式处理器 :
Fixed-point types, which is based on the proposal N1169: Extensions to support embedded processors:
-
0.5小时
,0.5R
,0.5ulr
等→_Fract
类型(定点类型的幅度≤1) -
5.0hk
,5.0K
,5.0ulk
等→_accum
类型(固定点类型)
0.5hr
,0.5r
,0.5ulr
, etc. →_Fract
types (fixed point types with magnitude ≤ 1)5.0hk
,5.0k
,5.0ulk
, etc. →_Accum
types (fixed point types)
这篇关于ç浮点数字符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!