home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 015.lha / tracer_source / MyMath.c < prev    next >
C/C++ Source or Header  |  1986-11-10  |  1KB  |  62 lines

  1. /*
  2.     MyMath.c
  3.  
  4.     My interface to the fast floating point routine library
  5.     which lattice doesn't like us to talk to.
  6. */
  7.  
  8. #define    DONT_BARK_MATH
  9.  
  10. #include "MyMath.h"
  11.  
  12. long    MathBase;    /* Basic FFP lib pointer */
  13. long    MathTransBase;    /* Transcendental FFP lib pointer */
  14. extern    long    OpenLibrary();
  15.  
  16.  
  17. /*  Open ROM and RAM FFP libraries   */
  18. int    open_math()
  19. {
  20.     if( ! (MathBase = OpenLibrary("mathffp.library", 0) ) ) {
  21.         printf("ERROR: Couldn't open mathffp.library\n");
  22.         return(0);
  23.     }
  24.  
  25.     if( ! (MathTransBase = OpenLibrary("mathtrans.library", 0) ) ) {
  26.         printf("ERROR: Couldn't open mathtrans.library\n");
  27.         CloseLibrary(MathBase);
  28.         return(0);
  29.     }
  30.     return(1);
  31. }
  32.  
  33. void    close_math()
  34. {
  35.  
  36.     if( MathTransBase )
  37.         CloseLibrary(MathTransBase);
  38.  
  39.     if( MathBase ) 
  40.         CloseLibrary(MathBase);
  41. }
  42.  
  43.  
  44. IEEE    ffp_to_ieee(in_val)   /* Convert to IEEE */
  45. register    FFP    in_val;
  46. {
  47.     register    fp    k;
  48.  
  49.     k.ffp = SPTieee(in_val);
  50.     return(k.ieee);
  51. }
  52.  
  53.  
  54. FFP    ieee_to_ffp( in_val )
  55. register    IEEE    in_val;
  56. {
  57.     register    fp    k;
  58.  
  59.     k.ieee = in_val;
  60.     return( SPFieee(k.ffp) );
  61. }
  62.