[SOLVED] representation of FLOAT in c++

Status
Not open for further replies.

m2star

Junior Member level 1
Joined
May 1, 2010
Messages
18
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
Rawalpindi, Pakistan, Pakistan
Activity points
1,390
union {uchar byt[4]; float wrd;} asdf;
asdf.wrd=45.6546

i do have a code that contains above function
can any one tell me, in which form this constant data is being stored in the float
like how can i specify that
asdf =[????]
 

Reactions: m2star

    m2star

    Points: 2
    Helpful Answer Positive Rating
To be precise, C or C++ don't rely on a specific number representation, neither for integer nor float quantities. This point is considered implementation dependent. Fixing a specific number format (nevertheless most compilers are using IEEE-754) would foil code portability.
 
Reactions: m2star

    m2star

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…