Subj : Re: Any help on why? To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Wed Jul 07 2004 10:32 am Thomas Maeder [TeamB] wrote: >What does "The Hex representation of a floating point number" mean? >What is result of applying that representation to 3.1415? Dunno as I dislike the inaccuracy of floats and doubles, and I've never had enough desire to learn *exactly* how the mantisa/etc are encoded. However, the Hex of it shows the full implementation. Now I've forgotten what the value portion is.... I remember the mantisa scales the result so there are no leading zeros, but I forget what the "number" portion is called...... OP showed output that looks a lot like the interal of a float to me: >Given arguments: 1.5, 2.5, 3.5 and 4.5 >The number of arguments is : 4 >0 0, 3FF80000 >1 0, 40040000 >2 0, 400C0000 >3 0, 40120000 Ok, I'll write a proggie. BCB5. pi pushes 8 bytes {char pie[40]; float pi = 3.1415; int i; for( i=0;i<10;i++) { sprintf(pie,"pi=%f %LX",pi,pi); cputs( pie); cputs("\n\r");//works better on my console than \r\n pi+=pi; } pi=3.141500 400921CAC0000000 pi=6.283000 401921CAC0000000 pi=12.566000 402921CAC0000000 pi=25.132000 403921CAC0000000 pi=50.264000 404921CAC0000000 pi=100.528000 405921CAC0000000 pi=201.056000 406921CAC0000000 pi=402.112000 407921CAC0000000 pi=804.223999 408921CAC0000000 pi=1608.447998 409921CAC0000000 Looks like 400 is the mantisa and 31415 == 921cac .