Domanda

If I take pi, for example, and find a random number from 1 to 1000, then divide pi by that number. Then, multiply pi by that number.

Should that cause floating point error?

(and, what is acceptable error on a processor?)

È stato utile?

Soluzione

Yes, that will almost certainly result in error (in the sense that the result will not be identical to the original value).

If you want to find the error, then what's wrong (in this case) with original - final?

Altri suggerimenti

Your question is very broad -- far too broad to try to answer in a few paragraphs on Stack Overflow. Instead, try reading this famous paper, entitled "What every Computer Scientist Should Know About Floating Point Arithmetic":

http://www.math.umd.edu/~jkolesar/mait613/floating_point_math.pdf

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top