Jan-Erik Soderholm escreveu: > solarwind wrote: > = >> HI-TECH C is using 24 bit float (I'm having problems with their 32 bit >> option) and in their manual it says they have a 15 bit mantissa and >> the MSB is implied, therefore I should get at least 5 digits of >> precision. When I compute sin 60 degrees, the answer should be >> 0.866025404 but I'm only getting 0.8660xxx... where the x are >> incorrect digits. Odd... >> >> = > > Probaly "just enough" for the applications that > the actual tools (PIC and the compiler) was ment > for in the first place. That is, *not* a "calculator". > > I'd think that most calculators uses some fixed > point BCD or decimal arithmetic to get a constant > and predictable precision and known (or none?) > rounding errors. > > Jan-Erik. > = The old 8-bit personal computers used packed BCD floating point math. It is a good option for a calculator because it will preserve the precision of the user input. For instance, a binary floating point type cannot represent 0.1 (one tenth) exactly. Try this: long i; float f; for( i =3D 1000000, f =3D 0.0; i; i-- ) f +=3D 0.1; printf( "1000000 x 0.1 =3D %f", f ); With packed BCD floats you will get exactly two decimal digits per byte in the mantissa. Best regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist