## Machine numbers and rounding problems

A computer cannot store any value of a continuous distribution exactly, and continuous values get discretized (rounded) on a fine scale. The rounding of values and storage of values as machine numbers should always be kept in mind; for most applications, this doesn't lead to any problems.

"Most" means "not always". Some examples are shown in the following topics that will leave most users without background knowledge in machine numbers perplexed and irritated.

As a motivating example, the following "bug'' report (software R) serves as an example:

*From: [email protected]*

*Subject: error in function trunc*

*Date: Fri, Jul 2007 15:03:58 +0200 6 (CEST)*

*The following command will get a wrong result:*

trunc (2.3 * 100)## [1] 229

*Answer Duncan Murdoch: That is the correct answer. 2.3 is not representable Exactly; The actual value used is slightly less.*

Remark: `trunc()`

is the largest integer in cutting a value off after the decimal...