We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I'm making use of floating math in my application and have run into a little problem with floating addition. It seems that the floating addition operation looses data at some point. I setup the following test program:
#include <intrins.h> void main(void) { float t, v; unsigned int i; while(1) { // this block uses multiplication for(i=1; i<1000; i++) { t = 5964.1 * i; v = t/i; if(v != 5964.1) _nop_(); } t = 0; // this block will continuously add 5964.1 for(i=1; i<1000; i++) { t += 5964.1; v = t/i; if(v != 5964.1) _nop_(); } } }
But if you see a manifest constant written 0.1, that practically always is floating point. I don't think I've seen any programming language in which "10.0 * 0.1" would be evaluated in some fixed point number format. Have you? I have programmed for more years than most and never had to use floating point. Floating point is the lazy mans way to handle fractions. Erik
"Floating point is the lazy mans way to handle fractions" That what I want to learn!!!Thanks a lot! I'm really a lazy man.