Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
sbrother
4 days ago
|
parent
|
context
|
favorite
| on:
Project Euler #912: Where are the Odds?
That is mind blowing, but it’s not immediately obvious to me that it’s equivalent for n > sqrt(INT_MAX). Is it? And if so, is the compiler somehow smart enough to know that?
marin049
4 days ago
|
next
[–]
Integer overflow is actually undefined behaviour thus the compiler is free to assume it doesn't happen.
reply
xigoi
3 days ago
|
prev
[–]
If you assume two’s complement arithmetic, then this is always equivalent because you’re basically just calculating the answer in a modular ring.
reply
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: