home *** CD-ROM | disk | FTP | other *** search
- /*
- MyMath.c
-
- My interface to the fast floating point routine library
- which lattice doesn't like us to talk to.
- */
-
- #define DONT_BARK_MATH
-
- #include "MyMath.h"
-
- long MathBase; /* Basic FFP lib pointer */
- long MathTransBase; /* Transcendental FFP lib pointer */
- extern long OpenLibrary();
-
-
- /* Open ROM and RAM FFP libraries */
- int open_math()
- {
- if( ! (MathBase = OpenLibrary("mathffp.library", 0) ) ) {
- printf("ERROR: Couldn't open mathffp.library\n");
- return(0);
- }
-
- if( ! (MathTransBase = OpenLibrary("mathtrans.library", 0) ) ) {
- printf("ERROR: Couldn't open mathtrans.library\n");
- CloseLibrary(MathBase);
- return(0);
- }
- return(1);
- }
-
- void close_math()
- {
-
- if( MathTransBase )
- CloseLibrary(MathTransBase);
-
- if( MathBase )
- CloseLibrary(MathBase);
- }
-
-
- IEEE ffp_to_ieee(in_val) /* Convert to IEEE */
- register FFP in_val;
- {
- register fp k;
-
- k.ffp = SPTieee(in_val);
- return(k.ieee);
- }
-
-
- FFP ieee_to_ffp( in_val )
- register IEEE in_val;
- {
- register fp k;
-
- k.ieee = in_val;
- return( SPFieee(k.ffp) );
- }
-