|
Long long and long double
Author |
Message |
Stephano Marian #1 / 4
|
Long long and long double
Are long long (64-bit) and long double (96-bit) ANSI/ISO compliant... I use gcc (3.0.1) as my compiler, and it spews warnings about long long (i haven't used long double yet!) not being ANSI compliant. Please shed some light on this. TIA, Stephano Mariani
|
Wed, 09 Jun 2004 10:23:56 GMT |
|
|
Tim Princ #2 / 4
|
Long long and long double
gcc warnings about long long are a relic of the days before C99. -fstd=c9x and its relatives will correct this. The biggest name in Windows C doesn't support long long, although the standard requires it. Long double is ANSI/ISO compliant. The standard provides only that it is at least as wide in mantissa and exponent as double. As long as you allow for, but don't count on, it being wider than double, you can use it portably. On a few gcc targets, long double is wider than double, but is supported by the library only when within double range. On the most commonly used gcc implementations, some of the math functions fail to implement long double fully, although it's supported for the most part. Windows compilers don't all bother to treat long double the way their own documentation indicates, as there is little inter-operability of long double between brands. How's that for equivocation?
Quote: > Are long long (64-bit) and long double (96-bit) ANSI/ISO compliant... > I use gcc (3.0.1) as my compiler, and it spews warnings about long long (i > haven't used long double yet!) not being ANSI compliant. Please shed some > light on this. > TIA, > Stephano Mariani
|
Wed, 09 Jun 2004 12:00:21 GMT |
|
|
Kevin Mille #3 / 4
|
Long long and long double
Quote:
> Are long long (64-bit) and long double (96-bit) ANSI/ISO compliant... > I use gcc (3.0.1) as my compiler, and it spews warnings about long long (i > haven't used long double yet!) not being ANSI compliant. Please shed some > light on this. > TIA, > Stephano Mariani
The type "long long" is not compliant with the C90 standard (which is what most ISO-compliant compilers available today adhere to), although it is compliant with the C99 standard. The type "long double" is compliant with both standards, but neither of them requires it, specifically or by inference, to be stored in 96 bits or more. In fact, "long double" need only be as accurate as "double", and "epsilon" for "long double" is not required to be any smaller than 1.0e-9. This "epsilon" is essentially the smallest number you can add to 1.0 in the given floating-point type and get something larger than 1.0.
|
Wed, 09 Jun 2004 12:29:29 GMT |
|
|
Lawrence Kir #4 / 4
|
Long long and long double
Quote: >Are long long (64-bit) and long double (96-bit) ANSI/ISO compliant... >I use gcc (3.0.1) as my compiler, and it spews warnings about long long (i >haven't used long double yet!) not being ANSI compliant. Please shed some >light on this.
long double has existed since the 1989 C standard, although its specification (i.e the minimum range and precision requirements) is the same as that for double. Varios compilers do implement them using the same format. long long was standardised in the 1999 version of the C standard. Some pre-1999 compilers do support it as an extension to the C90 standard although there were differences in the *printf() and *scanf() conversion specifiers for it prior to standardisation. -- -----------------------------------------
-----------------------------------------
|
Wed, 09 Jun 2004 21:36:43 GMT |
|
|
|