Timeline for Abandon all squares, ye who divide me
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 8, 2022 at 22:31 | comment | added | c-- | 49 bytes | |
May 16, 2017 at 3:13 | history | edited | algmyr | CC BY-SA 3.0 |
I'm dumb.
|
May 16, 2017 at 3:10 | comment | added | algmyr |
You're probably right about the undefined behavior. For some reason I thought that operator precedence would solve that. Most examples I've seen of UB uses same priority operators, but of course there is a data race here as well. You're also right about d++<n being correct, for some reason I didn't see that when I rewrote the code.
|
|
May 16, 2017 at 2:45 | comment | added | Ørjan Johansen |
Actually, shouldn't d++<n , which is well defined, still work? I think the old version went all the way to n+1 (harmlessly).
|
|
May 16, 2017 at 2:35 | comment | added | Ørjan Johansen |
++d*d is absolutely not well defined by the C standards - it's a classic case of explicitly undefined behavior. But we're going by implementations here, anyway.
|
|
May 16, 2017 at 2:23 | history | edited | algmyr | CC BY-SA 3.0 |
Improvements!
|
May 16, 2017 at 1:40 | comment | added | algmyr | @ØrjanJohansen That seems right. I was thinking construction rather than reduction. I have some additional improvements to add, will update soon. | |
May 16, 2017 at 0:55 | comment | added | Ørjan Johansen |
I think you can shorten it by removing r and instead use while(n%(d*d)<1)n/=d; .
|
|
May 15, 2017 at 19:39 | history | answered | algmyr | CC BY-SA 3.0 |