Hi,

I'm trying to do conversions between floats and doubles. I have the
following variables:

FlpCompDouble float_d;
FlpCompFloat  float_f;

These are defined in FloatMgr.h as:

typedef union {
        double                  d;              // for easy assignment of values
        FlpDouble                       fd;             // for calling New Floating 
point manager routines
        UInt32                  ul[2];  // for accessing upper and lower longs
        FlpDoubleBits           fdb;            // for accessing specific fields
} FlpCompDouble;

typedef union {
        float                   f;              // for easy assignment of values
        FlpFloat                        ff;             // for calling New Floating 
point manager routines
        UInt32                  ul;             // for accessing bits of the float
} FlpCompFloat;

It also defines the following conversion routines:

FlpFloat                _d_dtof(FlpDouble)      FLOAT_EM_TRAP(sysFloatEm_d_dtof);
FlpDouble               _f_ftod(FlpFloat)               
FLOAT_EM_TRAP(sysFloatEm_f_ftod);

If I convert like this:

float_d.d = (double) 97.0;
float_f.ff = _d_dtof(float_d.fd);

and then look at the value of float_f.f everything is correct. However, if I
try to convert like this:

float_f.f = (float) 97.0;
float_d.fd = _f_ftod(float_f.ff);

I get a "bus error" on the _f_ftod call. I've tried this with both the
Release and Debug 3.3 and 3.5 ROMs. Any ideas what I'm doing wrong? Thanks
in advance for any help on this.

Tom


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to