tag:blogger.com,1999:blog-6737713102444501259.post5529512101690649808..comments2019-07-10T23:01:31.725-07:00Comments on KO7M - Ham Radio Blog: Uh oh...Jeff ko7mhttp://www.blogger.com/profile/17258789919264407403noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6737713102444501259.post-37989135546184513272015-05-19T18:21:09.968-07:002015-05-19T18:21:09.968-07:00Agreed. I have confirmed it is a rounding error. ...Agreed. I have confirmed it is a rounding error. I was unsure of the number of bits in the floating point mantissa. Thanks for the confirmation!Jeff Whitlatchhttps://www.blogger.com/profile/17258789919264407403noreply@blogger.comtag:blogger.com,1999:blog-6737713102444501259.post-68650267407089745612015-05-19T05:58:20.422-07:002015-05-19T05:58:20.422-07:00That looks like expected rounding error. Since flo...That looks like expected rounding error. Since floats use binary internally, fractions that aren't exactly sums of powers of 2 are rounded. A float has 23 bits in the mantissa, which is smaller than the quantities you are expressing, so I'm sure it's round-off error. Doubles may solve the problem if the compiler has real doubles, but in general this is one of the reasons to not se floating point math in embedded or financial code. Stephenhttps://www.blogger.com/profile/04096748684396985279noreply@blogger.com