home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Libraries / MacOS PPC / x80<->double conversion / x80.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  927 b   |  42 lines  |  [TEXT/MPCC]

  1. /*
  2.  *    File:        x80.c
  3.  *                ©1993-1995 metrowerks Inc. All rights reserved
  4.  *
  5.  *    Content:    workaround for lack of 'long double' support in CodeWarrior for PowerPC
  6.  *
  7.  *    Use these routines instead of x80told() and ldtox80() from <fp.h>.
  8.  *
  9.  *    CodeWarrior does not support the 128-bit 'long double' format expected
  10.  *    by the various MathLib routines. All of these routines have 'double'
  11.  *    counterparts except for x80told() and ldtox80(). We provide 'double'
  12.  *    versions of those routines here.
  13.  *
  14.  *    This file should be compiled with PPCC using the following command line:
  15.  *
  16.  *    ppcc -appleext on -sym off -opt off -ldsize 128 x80.c -o x80.o
  17.  */
  18.  
  19. #ifndef __FP__
  20. #include <fp.h>
  21. #endif
  22.  
  23. #ifndef __X80__
  24. #include <x80.h>
  25. #endif
  26.  
  27. void x80tod ( const extended80 *x80, double *x )
  28. {
  29.     long double ld;
  30.     
  31.     x80told(x80, &ld);
  32.     *x = ld;
  33. }
  34.  
  35. void dtox80 ( const double *x, extended80 *x80 )
  36. {
  37.     long double ld;
  38.     
  39.     ld = *x;
  40.     ldtox80(&ld, x80);
  41. }
  42.