PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my settings
my profile
Public Pastes
Untitled
1 sec ago
&&&^^W...
50 sec ago
LLL Bartman vs. St...
4 sec ago
@@@@@@@@@watch Liv...
1 min ago
Untitled
5 sec ago
tiobench R510 w/ XFS
8 sec ago
Untitled
10 sec ago
700+ VIP & HD ...
15 sec ago
Weird Objective-C Mod Behavior
By: a guest on Jan 28th, 2012 | syntax:
None
| size: 0.17 KB | hits: 21 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
-1 % 3 = 2
0 % 3 = 0
1 % 3 = 1
2 % 3 = 2
-1 % 3 = -1
0 % 3 = 0
1 % 3 = 1
2 % 3 = 2
result = n % 3;
if( result < 0 ) result += 3;
result = (n+1002) % 3;
create a
new version
of this paste
RAW Paste Data
-1 % 3 = 2 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 -1 % 3 = -1 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 result = n % 3; if( result < 0 ) result += 3; result = (n+1002) % 3;