karel icon indicating copy to clipboard operation
karel copied to clipboard

AddFast 2.4.3

Open vktrrdk opened this issue 4 years ago • 3 comments

Hi! I have a feeling that when solving the AddFast level, the last carry bit or the entire most-significant bit is forgotten during addition.

vktrrdk avatar Oct 20 '21 17:10 vktrrdk

the last carry bit or the entire most-significant bit is forgotten

That was a deliberate decision to sensitize my students to "integer overflow"; the sum of 2 n-bit numbers may not fit into n bits.

Most mainstream programming languages suffer from this as well. For example, 1 billion plus 2 billion is -1294967296 in Java.

fredoverflow avatar Apr 27 '22 04:04 fredoverflow

Hey! So there is no right Answer in this level ?

MotoMisch avatar Dec 12 '22 19:12 MotoMisch

Depends on what you mean by "right answer". In byte arithmetic, 255+1 = 0

fredoverflow avatar Dec 13 '22 18:12 fredoverflow