1 /* Because fload is defined to "int" later below,
2 and we still need the real float in some places */
4 typedef float realfloat
;
12 /* !!!! Where you see "float" later below, "int" will be
13 used instead by the compiler !!!! */
17 /* Because of the define above, the math protos/defines are
18 changed in such a way that all parameters are assumed to
19 be integers and also the return value is assumed to be
22 #include <proto/exec.h>
23 #include <proto/mathffp.h>
24 #include <proto/mathtrans.h>
25 #include <libraries/mathffp.h>
28 struct MathBase
*MathBase
;
29 struct MathTransBase
*MathTransBase
;
31 realfloat
converttofloat(float ffpfloat
)
41 void domul(realfloat a
, realfloat b
)
43 union kludge x
, y
, res
;
51 res
.i
= SPMul(x
.i
, y
.i
);
54 printf("mathffp : %f x %f = %f (hex %x)\n",
55 converttofloat(x
.i
), converttofloat(y
.i
), converttofloat(res
.i
), res
.i
);
56 printf("realfloat: %f x %f = %f\n",
63 MathBase
= (struct MathBase
*)OpenLibrary("mathffp.library", 0);
64 if (!MathBase
) return;
66 /* mathtrans.library is needed for SPFieee() function to convert
67 a float to IEEE floating point format */
69 MathTransBase
= (struct MathTransBase
*)OpenLibrary("mathtrans.library", 0);
70 if (!MathTransBase
) return;
82 CloseLibrary((struct Library
*)MathTransBase
);
83 CloseLibrary((struct Library
*)MathBase
);