Vote UpVote

In Delphi, is addition commutative?

Delphi Corner Weblog – Answer: no, not necessarily. Despite the existence of operator precedence, i.e. the fact that the following X := 3 + 4 * 5; results in 23 and not in 35, the order of operands can still have an effect. In my BigInteger code, I discovered an odd error, that only happened in some very rare cases, and only in PUREPASCAL code, i.e. code that did not use assembler, and only in 64 bit. It took me several hours to find out that this was the problematic expression: Value := NormDividend[I + J] + NormDivisor[I] + Value shr CDivLimbBits; CDivLimbBits is a constant with value 32, Value is an ...
Favorite? Off-Topic? Rudy Velthuis @ 2016-02-02 00:01


Visits: 1398
Votes: 0
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)