Sunday 15 May 2011

Float24 (24 bit floating point) to Hex? -



Float24 (24 bit floating point) to Hex? -

i'm using float 24 bit store floating point value in compiler mrk iii nxp. stores 24 bit float value 3 byte hex in info memory. when i'm using ieee 754 float point conversion retrieve number binary real, i'm getting strange.

let me set way illustration -

note - "since compiler supports float 24 bit (along float 32), i'm assigning value this."

sample programme :

float24 f24test; float f32test; f32test= 2.9612; f24test= (float24)f32test;

output in debug window (global variable) :-

f32test = 2.961200e+000 f24test = 2.9612e+000

values stored in dm(data memory @ same time) captured debugger -

f32test = 40 3d 84 4d (in hex) f24test = 02 3d 84 (in hex)

problem :- when i'm trying convert f32test = 40 3d 84 4d (in hex) in binary & floating using ieee 754 , retrieve 2.9612. while @ same time when i'm trying convert f24test = 02 3d 84 (in hex) in binary & floating using ieee 754 , not retrieve 2.9612 instead weird value.

i'm looking wiki page refer floating point arithmetic's -: http://en.wikipedia.org/wiki/single-precision_floating-point_format

i'm confused why not working float 24 if i'm using same format 1 sign bit, 8 bit exponent & 15 bit mantissa. (in float 32 1 sign bit, 8 bit exponent & 23 bit mantissa.)

can 1 of guys help me value 2.9612 f24test = 02 3d 84 (in hex) ???

please , i've been struggling past 15 hours :(

thank in advance:)

f32test = 40 3d 84 4d (in hex)

f24test = 02 3d 84 (in hex)

in ieee 754 floating-point formats, floating-point exponent stored bias. clearly, whoever designed 24-bit floating-point format referring did not take utilize same bias scheme used in ieee 754 binary32, since values of exponent bits of 2 representations above not match despite exponents of both beingness represented 8 bits (according you).

in 32-bit representation, exponent represented bits 0x80, sounds right representation of value between 2 , 4.

you start hypothesis exponent in 24-bit format has bias of 0x04, , confirm more values. single value not plenty create sense of 24-bit floating-point format isn't part of ieee 754 standard , designed exotic choices.

floating-point floating-accuracy floating-point-precision floating floating-point-conversion

No comments:

Post a Comment