should double have better precision or greater range?

Doug Gwyn gwyn at smoke.ARPA
Wed Sep 7 16:42:45 AEST 1988


In article <8809061831.AA29128 at ucbvax.Berkeley.EDU> U23405 at UICVM (Michael J. Steiner) writes:
>I may go as far as to say that there should be two kinds of doubles, one
>with better precision and another with greater range.

The whole business of specifying detailed attributes of data types in a C-like
language is something that should be totally reworked, rather than patched.

>Also, I recently heard of a "long double". Since double is defined as
>"long float", this would mean "long long float", which is confusing.

"long float" is out; if you've been using this, you're advised to change
it to "double" before you bump into a compiler that doesn't recognize
"long float".  "long double" is new with ANSI C.

>One last thing: Would an expression be evaluated more quickly if the RHS
>had variables of type short or type int?

That depends on the implementation.  "int" is usually the fastest data
type, but not always.  Just express the computation correctly and let
the compiler worry about such micro-optimization.



More information about the Comp.lang.c mailing list