[comp.sys.mac.programmer] LSC size of double type

dplatt@coherent.com (Dave Platt) (08/13/88)

In article <1209@raybed2.UUCP> erm@raybed2.UUCP (ELIZABETH MORGAN) writes:
> On a MAC SE using LSC 3.0 the size of the double type is 10 bytes
> not 8 bytes as I would expect.  I used sizeof(double) to get this.
> Can anyone explain this ?

LightSpeed C (all versions) store the C data type "double" as a SANE/IEEE
"extended".  They do this in order to comply with the C language spec, which
states that "double" is the maximal-precision floating-point format
available in the machine.  Also, both SANE and the 68881 do their _fastest_
math on "extended"-format numbers;  all shorter floating-point formats are
converted to "extended" prior to being used, and the results of a calculation
are converted from "extended" to the format that the program expects.

If you want a SANE/IEEE "double" (which is what some other compilers
use for a C "double"), you can get it by asking LSC for a "short
double".

-- 
Dave Platt                                             VOICE: (415) 493-8805
  USNAIL: Coherent Thought Inc.  3350 West Bayshore #205  Palo Alto CA 94303
  UUCP: ...!{ames,sun,uunet}!coherent!dplatt     DOMAIN: dplatt@coherent.com
  INTERNET:   coherent!dplatt@ames.arpa,    ...@sun.com,    ...@uunet.uu.net