[Mono-dev] Simple floating maths problem

Andreas Nahr ClassDevelopment at A-SoftTech.com
Fri Apr 30 05:31:07 EDT 2010


Just some guess:
When looking at the numbers it seems more likely that the issue is not
precision of the arithmetics, but rounding of the results for casting to
integer (for float it should round to nearest number (See C# spec. p139)).
Maybe mono just cuts for the conversion as it is done for integral types.

Greetings
Andreas

-----Ursprüngliche Nachricht-----
Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von Stuart
Fraser
Gesendet: Freitag, 30. April 2010 00:22
An: mono-devel-list at lists.ximian.com
Betreff: [Mono-dev] Simple floating maths problem

Mono results:
0.95864 * 50000 = 47931
0.89374 * 50000 = 44686
0.89092 * 50000 = 44545
0.89716 * 50000 = 44857
0.4191 * 50000 = 20954
0.79782 * 50000 = 39890

.Net results :
0.95864 * 50000 = 47932
0.89374 * 50000 = 44687
0.89092 * 50000 = 44546
0.89716 * 50000 = 44858
0.4191 * 50000 = 20955
0.79782 * 50000 = 39891





More information about the Mono-devel-list mailing list