user-0 提问: while中表达式的定义

回复:
user: user-1
content: X86上，32Bits Windows 操作系统下，MS VC6，7，8，9，10.。。etc long double 是 64Bits

user: user-1
content: 80 Bits 浮点数一位符号，15位指数，64位尾数 所以可以表示的数最大的正数到最小正数，大约是 2^ (2^14)-1 ~ 2^ (-(2^14 +64-1))  2^14 =16384   18384* lg(2) = 16453* 0.3010 = 4931.584 2^(- 16384 +64 -1) =2^-16453 16453* lg(2) = 16453* 0.3010 = 4952.35  10^ 4931.584 ~10^- 4952.35 省略小数部分 即10^ 4931 ~10^- 4952 10 大约 除以 4952次10 以后，等于0.000000000000000 即正0  X86上，32Bits Windows 操作系统下，有些系统long double 是 80Bits（BCB，minGw），有些是64Bits（MS） X86上，32Bits Windows 操作系统下，minGw 的long double是 12字节的，80Bits浮点数，其中前两个字节恒为0；

user: user-2
content: 来自你的num定义的long double格式的最小表示数值的10的幂次数绝对值。

user: user-3
content: 为什么 num循环的第一个输出值 为0.000000  而不是1.000000

user: user-4
content: n没有初始化，得到多少都有可能

user: user-0
content: 我用gcc上编译的时候，n被默认赋值为0了，这个是我没有留意，那么可以将int n = 0；，关于这个我主要是想知道在长精度浮点型的情况下，while中的条件表达式是如何等于0而停止循环的？

user: user-5
content: 1. n没有初始化，结果多少都有可能 2. double的指数范围-1023 ~1024, 2^-1023约等于10^-308 所以循环大约会执行309次

user: user-6
content: 引用 3 楼 Falleyes 的回复:楼主的程序在vs2013上忽略错误，运行：  未赋值的n初始赋值-858993460。  这个赋值要看编译器。 确实楼主的n没有赋初值，呵呵。

user: user-7
content: 楼主的程序在vs2013上忽略错误，运行：  未赋值的n初始赋值-858993460。  这个赋值要看编译器。

user: user-6
content: while(num);//用以下汇编翻译，楼主可以参考下 00412043  fldz              00412045  fcomp       qword ptr [num]  00412048  fnstsw      ax    0041204A  test        ah,44h  0041204D  jp          main+2Eh (41200Eh)

user: user-8
content: 常量也有类型！ C++ Integer Constants Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or hexadecimal form. They can specify signed or unsigned types and long or short types.  Syntax  integer-constant :  decimal-constant integer-suffixopt octal-constant integer-suffixopt hexadecimal-constant integer-suffixopt 'c-char-sequence'  decimal-constant :  nonzero-digit decimal-constant digit  octal-constant :  0 octal-constant octal-digit  hexadecimal-constant :  0x hexadecimal-digit 0X hexadecimal-digit hexadecimal-constant hexadecimal-digit  nonzero-digit : one of  1 2 3 4 5 6 7 8 9  octal-digit : one of  0 1 2 3 4 5 6 7  hexadecimal-digit : one of  0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F  integer-suffix :  unsigned-suffix long-suffixopt long-suffix unsigned-suffixopt  unsigned-suffix : one of  u U  long-suffix : one of  l L  64-bit integer-suffix :  i64  To specify integer constants using octal or hexadecimal notation, use a prefix that denotes the base. To specify an integer constant of a given integral type, use a suffix that denotes the type.  To specify a decimal constant, begin the specification with a nonzero digit. For example:  int i = 157;   // Decimal constant int j = 0198;  // Not a decimal number; erroneous octal constant int k = 0365;  // Leading zero specifies octal constant, not decimal  To specify an octal constant, begin the specification with 0, followed by a sequence of digits in the range 0 through 7. The digits 8 and 9 are errors in specifying an octal constant. For example:  int i = 0377;   // Octal constant int j = 0397;   // Error: 9 is not an octal digit  To specify a hexadecimal constant, begin the specification with 0x or 0X (the case of the “x” does not matter), followed by a sequence of digits in the range 0 through 9 and a (or A) through f (or F). Hexadecimal digits a (or A) through f (or F) represent values in the range 10 through 15. For example:  int i = 0x3fff;   // Hexadecimal constant int j = 0X3FFF;   // Equal to i  To specify an unsigned type, use either the u or U suffix. To specify a long type, use either the l or L suffix. For example:  unsigned uVal = 328u;             // Unsigned value long lVal = 0x7FFFFFL;            // Long value specified                                    //  as hex constant unsigned long ulVal = 0776745ul;  // Unsigned long value  C++ Floating-Point Constants Floating-point constants specify values that must have a fractional part. These values contain decimal points (.) and can contain exponents.  Syntax  floating-constant :  fractional-constant exponent-partopt floating-suffixopt digit-sequence exponent-part floating-suffixopt  fractional-constant :  digit-sequenceopt . digit-sequence digit-sequence .  exponent-part :  e signopt digit-sequence E signopt digit-sequence  sign : one of  + –  digit-sequence :  digit digit-sequence digit  floating-suffix :one of  f l F L  Floating-point constants have a “mantissa,” which specifies the value of the number, an “exponent,” which specifies the magnitude of the number, and an optional suffix that specifies the constant’s type. The mantissa is specified as a sequence of digits followed by a period, followed by an optional sequence of digits representing the fractional part of the number. For example:  18.46 38.  The exponent, if present, specifies the magnitude of the number as a power of 10, as shown in the following example:  18.46e0      // 18.46 18.46e1      // 184.6  If an exponent is present, the trailing decimal point is unnecessary in whole numbers such as 18E0.  Floating-point constants default to type double. By using the suffixes f or l (or F or L — the suffix is not case sensitive), the constant can be specified as float or long double, respectively.  Although long double and double have the same representation, they are not the same type. For example, you can have overloaded functions like  void func( double );  and   void func( long double );