yes I know it's a type I am just asking for the purpose of extracting mantissa sign and exponent why does the sign has to be the type of int_4 and the mantissa has to be int_u8, like that??
yes I know it's a type I am just asking for the purpose of extracting mantissa sign and exponent why does the sign has to be the type of int_4 and the mantissa has to be int_u8, like that??
and does it matter in 64 bit computers there isn't any difference to hold these values because a float is a 32 bit too, but what matters is that the size of int is different in 64 bit right?? like they are 8 byte instead of 4 byte?? am I right??
okay so if there is an assignment that would ask you to use a typedef to assign int_4, int_u4, int_8, and int_u8 into a 64 bit machine.. how would you do this?? assuming it's running on windows
no I want int_4 to be the type not int32_t so I guess you have it reversed
Ya know, between the various threads -EquinoX- has created on essentially the same problem, and all of the twists and turns and arguments and explanations, I have to say: I am almost thoroughly confused as to the point of it all.
At best I'd like to think it is about capturing the bit image of an IEEE-754 single-precision floating point value and separating those bits into 3 integral values for sign, exponent, and mantissa. Plus some caveat about trying to be portable.
We've mentioned the usual approaches: wandering the bytes, casting, and a union. All have various portability issues.
Is there someone, anyone, who can give me the nickel summary?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Why not just print if into a string and all your problems are solved.
"print if"? I guess you mean "printf", or more precisely "sprintf", right? Printing "if" into a string would get you a string with, well, "if", which is hardly helpful.
With that method, you won't get the exact exponent and mantissa.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
On whose keyboard? Maybe esbo has a Dvorak keyboard . . . .
You're probably right, though.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.