Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
adwn
· 3y ago · 0 comments
That doesn't work when both are odd. For example, for x=1 and y=3 this gives 1 instead of 2.
Comments
[–]
someweirdperson
3y ago
1/2 + 3/2 + 1 = 0 + 1 + 1 = 2
[–]
rocqua
3y ago
Your final +1 is not in the expression by OP. You can get it by taking the correction term (x & y & 1) as mentioned in another comment.
[–]
someweirdperson
3y ago
woops, misread the indent-depth of the posts as reply, not to the same parent.