This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Question for displaying floating point in eCOSaplication. Thanks a lot


On Thu, 2003-08-07 at 08:20, QiangHuang wrote:
> Hi:
> 
> Another more comprehensive try:
> 
> double test_double=4.00;
> float test_float=4.00;
> cyg_uint32 test_data = 0x40800000;
> float cov_data=0.00;
> cov_data = ((float)test_data);
> printf("test_double = %f, test_float = %f\n", test_double, test_float);
> printf("test_double=0x%llx, test_float=0x%llx\n", test_double, test_float);
> printf("test_data = %f, test_data = 0x%llx\n", (float)test_data, test_data);
> printf("cov_data = %f, cov_data = 0x%llx\n", cov_data, cov_data);
> 
> // Output as:
> test_double = 4.000000, test_float = 4.000000
> test_double=0x40100000, test_float=0x40100000
> test_data = 1082130432.000000, test_data = 0x40800000
> cov_data = 1082130432.000000, cov_data = 0x41d02000
> 
> seems no matter I set the variable to either float or double they are using
> the same format as real*8, is this the case?
> 

Most likely, the compiler is storing both 'float' and 'double' the
same on this architecture.  [Note: I've not verified this myself]

What is 'sizeof(double)' and 'sizeof(float)'?

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]