??? 10/24/07 07:07 Read: times |
#146117 - The compiler isn't going to take care of that. Responding to: ???'s previous message |
Then again, we have these wonderful compilers that take care of all the repetative but complex stuff.
Sorry, the compiler only knows how to add _two_ floating point numbers. It doesn't know how to _correctly_ (i.e. minimum error) add several of them, which is a bit more involved than just "adding" them up: If you add more than two floating point numbers, you actually have to _sort_ them by their absolute value, (a) then remove the two numbers with the lowest absolute value and insert their sum into the list at the right place, and repeat from (a) until the list contains only one element, which is your result. If you don't do that, you'll end up with (large number X + bunch of small numbers = X). Even some commercial software (*cough* MS Excel) doesn't do that right. And that's just one of the many issues one can run into when working with numbers that have a value-dependent granularity. In signal processing, you, the designer, usually know best how many bits of precision are needed at which point of the calculation, where numbers are supposed to be rounded, and so on. |