"Ben Combee" wrote:
> At 09:56 PM 3/6/2004, you wrote:
> >hi,
> >I am confused about the use of double, FlpDouble and FlpCompDouble in
Palm,
> >what are the differences if MathLib is included?
> >
> >
> >#include <FloatMgr.h>
> >#include "MathLib.h"
> >
> >Char long_d[4] = "123",
> > long_m[8] = "45.6789";
> >FlpDouble longitude_d, longitude_m;
> >double pi = 3.14159265358979;
> >double hk80 = 0.00244444444444;
> >
> > longitude_d = FlpAToF(long_d);
> > longitude_m = FlpAToF(long_m);
> > longitude_m = longitude_m/pi;
> > longitude_m = longitude_m - hk80;
> >
> >also, when i run the above codes, no matter how do i swap the use of
double,
> >FlpDouble and FlpCompDouble.fd , it still has error.
>
> You shouldn't ever need to use types other than 'double', except for
> calling a few OS functions.
>
> FlpCompDouble is a composite type, a union of "FlpDouble" and
> "double". Here's the definition:
>
> typedef union {
> double d;
> FlpDouble fd;
> UInt32 ul[2];
> FlpDoubleBits fdb;
> } FlpCompDouble;
>
> You can declare one of these, assign your double value to its .d member,
> then pass the address of its .fd member to any functions needed a
FlpDouble.
>
> BTW, you don't need to #include <FloatMgr.h>... this is included in the
> standard <PalmOS.h> header bundle.
>
> You didn't say what tool you were using -- if you're using prc-tools
(GCC),
> you can't call FlpAToF directly. You need to use the FlpBufferAToF
version
> -- see the comments in FloatMgr.h for the reasons why you have to do this.
I am using CW.
It is solved, thank you!
And do you have any method to check the value of double?
I used to check integer value like this:
-------------------------------------------------------------
#define debug_int(msg, int) { \
char outStr[128]; \
StrPrintF(outStr, msg, int); \
WinDrawChars(outStr, StrLen(outStr), 50, 50 ); \
}
#define abort_int(msg, int) { \
char outStr2[128]; \
StrPrintF(outStr2, msg, int); \
ErrDisplayFileLineMsg(__FILE__, __LINE__,outStr2); \
}
debug_int("%d", int_value);
abort_int("%d", int_value);
-------------------------------------------------------------
But I cannot use "%f" because Palm does not support.
any suggestions?
thx
>
> -- Ben Combee, senior DTS engineer, PalmSource, Inc.
> Read "Combee on Palm OS" at http://palmos.combee.net/
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/