Topic : RC51 - incorrect floating point divison in constant expressions

Forum : 8051

Original Post
Post Information Post
August 2, 2007 - 7:04pm
Guest

In RC51, a particular constant FP division evaluates incorrectly

(unsigned char)(1.0/0.5) evaluates to 2 (OK)
(unsigned char)(3.0/0.5) evaluates to 6 (OK)

but

(unsigned char)(2.0/0.5) evaluates to 1 (Wrong, should be 4)

continuing...

(unsigned char)(4.0) -> 4 (OK)
(unsigned char)(2.1/0.5) -> 4 (OK)
(unsigned char)(2.0/0.25) -> 4 (OK)
(unsigned char)(2.1/1.0) -> 2 (OK)
(unsigned char)(1.99/0.5) -> 3 (OK)

So, there's a very particular error for 2.0/0.5. What's happening? Are there any other odd errors of this type?

My RC51 is 3.03.42 with the patch for the array access error in May (see my forum post a few entries back)

regards Steven Pruzina

Replies
Post Information Post
+1
0
-1
August 3, 2007 - 2:31pm
Guest

Hi Steven,

thank you for reporting this very specific bug. It has been fixed.

regards,
Lionel