Weird arithmetic

P

Pascal Gallois

In the long run, however, you can easily cause yourself and your colleagues
a lot of grief by ignoring the distinction between decimal and binary
arithmetic.

This is more an issue with excess precision and certainly x86 related. And
it also has to do with GCC insofar as even if you cast the value of
an expression involving excess precision to double which should get rid of
excess bits, it still goes wrong (against the standard (6.3.1.8 and
footnote 52)).

A possible solution would also be to use long double: long double m =
200.45L; The trailing L causes proper initialization of extended
precision bits.

- Pascal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top