User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Modulo operator is so HARD :( Page [1] 2 3 4, Next  
joe_schmoe
All American
18758 Posts
user info
edit post

man, i just want to write a function to find the last two posts on each page, but some mean ol' troll in Chit Chat says that my function is broken and won't work:

Quote :
"threads that satisfy the condition (50 % posts) <= 2 && (50 % posts) != 0"


of *course* that will work. LOOK, i proved it right here!

50 % 47        = 3
50 % 48 = 2
50 % 49 = 1
50 % 50 = 0


see? SEE??

now quit being a pedantic, pus-oozing scab on the ass of TWW, mmkay?

3/5/2009 3:41:21 AM

evan
All American
27701 Posts
user info
edit post

50 % 3 == 2
50 % 4 == 2
50 % 6 == 2
50 % 7 == 1
50 % 8 == 2
50 % 12 == 2
50 % 16 == 2
50 % 24 == 2
...
50 % 51 == 50
50 % 52 == 50

and so on with numbers above 50.

[Edited on March 5, 2009 at 4:35 AM. Reason : oh, you're bitching at Tiberius. i see.]

3/5/2009 4:29:24 AM

Tiberius
Suspended
7607 Posts
user info
edit post

This has got to be most desperate trolling I have ever seen. Have you had a death in the family or something?

3/5/2009 9:20:03 AM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
" use [of the modulo operator] is considered unnecessary obfuscation and poor programming practice in most cases, as well.

--Tiberius"


damn, dude, are you serious??? you just keep digging deeper and deeper. you really need to learn this shit.

http://legacy.cs.uu.nl/daan/download/papers/divmodnote.pdf



hey, were you the guy he interviewed? \/

http://developers.slashdot.org/comments.pl?sid=119859&cid=10108597





[Edited on March 5, 2009 at 10:54 AM. Reason : ]

3/5/2009 10:29:25 AM

WolfAce
All American
6458 Posts
user info
edit post

Any reason you're using modulo in a case where it's identical to subtraction except for giving more false positives?

3/5/2009 10:59:31 AM

joe_schmoe
All American
18758 Posts
user info
edit post

ask Tiberius to explain it to you. that ought to be good.

3/5/2009 11:08:49 AM

OmarBadu
zidik
25067 Posts
user info
edit post

give joe_schmoe a day timeout and delete this crap for him acting like a little baby

what a ridiculous way to go about things

3/5/2009 11:12:04 AM

qntmfred
retired
40552 Posts
user info
edit post

Quote :
"delete this crap for him acting like a little baby

what a ridiculous way to go about things"



^^^ modulus is the correct operator for this particular task, not subtraction.

3/5/2009 11:14:28 AM

joe_schmoe
All American
18758 Posts
user info
edit post

Oh, sorry Omar. I didnt realize you had a dog in this fight.

so, it's not an appropriate topic for TT? we have a new expert who has just disposed of the modulo operator.

i think that has far-reaching implications.


but whatever, i probably need a break from all this grabassery, anyhow.



[Edited on March 5, 2009 at 11:17 AM. Reason : ]

3/5/2009 11:15:37 AM

OmarBadu
zidik
25067 Posts
user info
edit post

don't worry - there won't ever be any confusion - i never have a dog in a fight on a message board...

3/5/2009 11:18:30 AM

qntmfred
retired
40552 Posts
user info
edit post

Quote :
"ALL

THIS

GRABASSERY"

3/5/2009 11:19:02 AM

ScHpEnXeL
Suspended
32613 Posts
user info
edit post

ibtl/suspend

3/5/2009 11:20:40 AM

darkone
(\/) (;,,,;) (\/)
11609 Posts
user info
edit post

This is a really strange trolling effort.

3/5/2009 11:27:09 AM

qntmfred
retired
40552 Posts
user info
edit post

i know right. at first i was intrigued and maybe a little excited to see a thread about modulus, but then i kept reading the thread and my brow began to furrow and my e-dick got limp. very disappointing indeed

3/5/2009 11:37:29 AM

Noen
All American
31346 Posts
user info
edit post

I'm just all kinds of

modulus is my favorite operator.

Also, joe is right, Tiberius is wrong on every level in this

3/5/2009 12:58:49 PM

dakota_man
All American
26584 Posts
user info
edit post

agreed

[Edited on March 5, 2009 at 1:11 PM. Reason : ASSERT(joe_schmoe % Tiberius == programming knowledge);]

3/5/2009 1:04:45 PM

joe_schmoe
All American
18758 Posts
user info
edit post

so i dont look like a retard to someone wandering in this thread... here's the starting point from the original, epic, 3am, ChitChat, e-peen battle:

message_topic.aspx?topic=560116&page=3#12693473

beware, there's a lot of

3/5/2009 1:20:00 PM

scud
All American
10804 Posts
user info
edit post


MOV AX, 203 ; AX = 00CBh
MOV BL, 50
DIV BL ; AL = 4 , AH = 3
RET

3/5/2009 1:25:07 PM

dakota_man
All American
26584 Posts
user info
edit post

oh, snap

3/5/2009 1:44:27 PM

joe_schmoe
All American
18758 Posts
user info
edit post

#define MOD(divis,divid)       divis - divid * floor(divis / divid)

3/5/2009 1:49:13 PM

sarijoul
All American
14208 Posts
user info
edit post

wouldn't you do the mod in the opposite order that you have:

if(mod(post,50)==49.or.mod(post,50)==48) then blah


so that mod(47,50) = 47
mod(48,50) = 48
mod(49,50) = 49
mod(149,50) = 49
mod(2,50) = 2

etc. . .

3/5/2009 2:15:23 PM

Noen
All American
31346 Posts
user info
edit post

^that's method/language specific. Joe is referring to modulus as an operator.

3/5/2009 3:30:02 PM

evan
All American
27701 Posts
user info
edit post

Quote :
"This is a really strange trolling effort."


inorite... i didn't understand it at all when i initially replied...

Quote :
"i know right. at first i was intrigued and maybe a little excited to see a thread about modulus, but then i kept reading the thread and my brow began to furrow and my e-dick got limp. very disappointing indeed"


i thought he was being serious in the OP
then i realized it was trolling and i was all

i, for one, love the modulus. one of the first programs i ever made involved a very intricate tree of if/ifelse/else loops to figure out what denomination and quantity of coins would give the fewest total number of coins in change i think i was like 11

3/5/2009 3:45:21 PM

sarijoul
All American
14208 Posts
user info
edit post

i don't know what sort of tomfoolery is going on here. but was my post wrong? i can accept that order of the arguments can change from language to language. but in any case, isn't the method that i propose different (and more correct) than the OP?

i get the feeling though that i'm missing some awesome joke because i don't care to look back through joe's post history in chit chat while at work.

3/5/2009 4:04:02 PM

joe_schmoe
All American
18758 Posts
user info
edit post

^ no, you're absolutely right. and which i merely pointed that out to Tiberius when this whole thing started

who rather than look at it and say "oh, yeah, you're right" instead went into a tizzy fit insisting that modulus operators do indeed work in this backasswards manner he dreamed up.

when he finally ran out of chestbeating, he claimed that it's just silly "pseudocode" that, in some desperate bid for attention, I subjected to "exhaustive verification"

particularly funny, since he actually wrote a script to "verify" his function and posted the results. divisors up to 50. That was his "proof". LOL when the rest of the world can just see it is broken by inspection.

of course, then there's his assertion that the modulus is "unnecessary obfuscation" and that real programmers decline to use it as it is "poor programming practice."

well, i don't know what the hell to make out of THAT




[Edited on March 5, 2009 at 4:12 PM. Reason : ]

3/5/2009 4:11:44 PM

sarijoul
All American
14208 Posts
user info
edit post

ok. i figured i was missing something.

3/5/2009 4:12:51 PM

scud
All American
10804 Posts
user info
edit post

Don't forget that he thinks because he can compile C with a C++ compiler means he knows C++ too.

3/5/2009 4:15:18 PM

evan
All American
27701 Posts
user info
edit post

Oh God,

joe_schmoe is pissed!

3/5/2009 4:15:28 PM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
"joe_schmoe:

if youre going to have those conditionals, you need to write it as

if ( 50 - posts % 50 <= 2 && 50 - post % 50 > 0 )

but that's kind of dumb, it would be more sensible to write it as

if ( posts % 50 >= 48 )"




Quote :
"Tiberius:

^^^uh, my logic is correct now, but please keep trying:

(root@I023)-(/) $ for ((x=47;x<=50;x++)); do echo 50 % $x = $((50 % $x)); done
50 % 47 = 3
50 % 48 = 2
50 % 49 = 1
50 % 50 = 0


I do admin and code professionally. I don't perform modulo calculations professionally. When I need a modulo calculator I will be sure to ring up joe_schmoe.

[Edited on March 5, 2009 at 3:04 AM. Reason : *snicker*]
"



Quote :
"Tiberius:

Modulo is not a mathematical operator "



Quote :
"Tiberius:

here's a cookie for being the pedantic ass"



joe_schmoe:

3/5/2009 4:19:26 PM

evan
All American
27701 Posts
user info
edit post

hey.

we all see your point, and it's completely valid. you are correct.

however, when you keep reiterating the same things over and over again in an attempt to make Tiberius look even worse, you lose credibility.

just sayin'.

3/5/2009 4:25:13 PM

joe_schmoe
All American
18758 Posts
user info
edit post

sorry. I come from TSB. us people are dicks over there.

It'd be one thing if he just argued the technical merits. but i get a little uppity when someone essentially calls me a stupid cocksucker, when that person doesnt know wtf they're talking about.

i mean if it were me, i'd be like O RLY? and re-look at my code rather than get personally offended and jump down someones throat ready to fight because the technical accuracy of some code snipped was questioned.

its this "tribal knowledge" mentality, rather than problem solving, that i find to be common with technicians and others lacking a formal engineering training.








[Edited on March 5, 2009 at 4:34 PM. Reason : ]

3/5/2009 4:26:01 PM

Solinari
All American
16957 Posts
user info
edit post

damn i thought this was a thread about modulus

[Edited on March 5, 2009 at 5:02 PM. Reason : s]

3/5/2009 4:57:54 PM

smoothcrim
Universal Magnetic!
18954 Posts
user info
edit post

doesn't the compiler convert mod statements to signed addition and shifts anyway?

3/5/2009 7:13:28 PM

Solinari
All American
16957 Posts
user info
edit post

who cares what the compiler does? Its self-documenting to use modulo

3/5/2009 7:15:56 PM

Tiberius
Suspended
7607 Posts
user info
edit post

holy fuck, is joe_schmoe still beating off about this? For everyone's reference, the post this is about:

"
Quote :
"BECAUSE NOBODY READS THE 48TH POST"


ATTN: threads that satisfy the condition (50 % posts) <= 2 && (50 % posts) != 0"

This post was made at 3AM, in Chit Chat, on a week (mid-terms here) where I've had approximately 12 hours of sleep. Yes, I was completely wrong in the implementation, I had a brain fart and have no problem admitting that. It's obviously not the first time I've encountered modulo, however, nor does it insinuate I provide Windows desktop support.

Joe proceded to derail the thread the post was made in for 2 pages discussing this lapse of logic, how I must obviously work as a Windows tech, and he's now made a seperate TT thread about it. This after Joe was attempting to troll d7freestyler regarding a randomly generated image in the same thread. Someone please give this man some attention before he hurts himself.

Quote :
"It'd be one thing if he just argued the technical merits. but i get a little uppity when someone essentially calls me a stupid cocksucker"


HOW IRONIC, my first response to you:

Quote :
"not quite

threads that are on post 49 or 48"


Your immediate response:

Quote :
""not quite" my ass

go back to CSC 114




OMG FUCKING HELL NOOOOOOOOOOOOOOOO"


I didn't insult you or direct any vulgarity at you until you became a huge flaming douche, and you continued to be a huge flaming douche throughout the discussion, up to the point of pointlessly reposting the thread in TT:

Quote :
"you dont write code professionally, i take it? that's okay. at least you're trying.... stick with it, you'll get better. if you want me to recommend some tutorials for you i know some free ones you can do on teh internets."


Quote :
"Don't beat yourself up about it though. Really, it's okay. Arithmetic Operators can be confusing for beginning programmers."


Quote :
"but, hey! I'm sure you're really good at stringing and terminating some CAT5. And I'll wager you can batch-install some mean AV software definitions, too. Don't be embarrassed. Most of you front-line IT guys don't really need to write code anyhow, just a few macros and maybe a perl or python script now and then. everyone understands this."


For the record, I've never worked as a network tech or in desktop support

I have, however, worked as a developer at two companies and for countless contracts, a Unix admin, a ClearCase admin, and supported a security and robustness testing initiative. Tell you what, though, PM me your contact details and I'll be sure to include you as a reference in the future, so you can let them know about that time you totally pwned me with regard to modulo in The Wolf Web's general discussion section.

[Edited on March 5, 2009 at 11:56 PM. Reason : not sure why I keep biting at this troll, sympathy attention I suppose ]

3/5/2009 11:52:39 PM

evan
All American
27701 Posts
user info
edit post

the further this progresses

the more of an ass joe_schmoe makes of himself

the more i start agreeing with Tiberius.

this simple (and admitted) mistake did not warrant such an attempt at trolling.

3/5/2009 11:54:33 PM

WolfAce
All American
6458 Posts
user info
edit post

This is why no one goes to Soap Box

3/5/2009 11:59:25 PM

Aficionado
Suspended
22518 Posts
user info
edit post

if there ever was a thread that legitimately deserved the carlface

3/6/2009 12:06:53 AM

joe_schmoe
All American
18758 Posts
user info
edit post

my work is done here.

3/6/2009 10:22:27 AM

kiljadn
All American
44689 Posts
user info
edit post

Quote :
""

3/6/2009 10:35:53 AM

Tiberius
Suspended
7607 Posts
user info
edit post

Quote :
"damn, dude, are you serious??? you just keep digging deeper and deeper. you really need to learn this shit."


I was serious. I obviously know what a modulus is and when to use it. Aside from the proper application of modulo at 3AM, pretty much everything you've said about it has been factually inaccurate. It's not a basic arithmetic operation, not directly related to Euclidean division, and in computer science vaguely implies any of several mathematical operations. The first line of your own source agrees:

There exist many definitions of the div and mod functions in computer science literature and programming languages.

As a consequence it's slower than equivalent operations on many platforms as smoothcrim insinuated, and yields inconsistent in its results for arguments <0, with language- and hardware-dependant variations:



For example, the modulo of powers of 2 can alternatively be expressed as a bitwise AND operation x % 2n == x & (2n - 1).

In some compilers, the modulo operation is implemented as mod(a, n) = a - n * floor(a / n). When performing both modulo and division on the same numbers, one can get the same result somewhat more efficiently by avoiding the actual modulo operator, and using the formula above on the result, avoiding an additional division operation.

Being too lazy to find specific examples of it being good practice vs poor practice, I'll take the statistical approach:

Results 1 - 10 of about 447,000 for modulo good practice. (0.21 seconds)
Results 1 - 10 of about 5,980,000 for modulo bad practice. (0.33 seconds)


Quote :
"my work is done here."


If your "work" was being a huge flaming douche, beating dick while harping on a minor error, and stifling a legitimate technical discussion then yes you were pretty thorough.

[Edited on March 6, 2009 at 12:35 PM. Reason : .]

3/6/2009 12:26:49 PM

qntmfred
retired
40552 Posts
user info
edit post

NOBODY CARES

STFU EVERYBODY

3/6/2009 12:28:43 PM

dakota_man
All American
26584 Posts
user info
edit post

Results 1 - 10 of about 27,500 for modulo operator bad practice. (0.32 seconds)
Results 1 - 10 of about 73,600 for modulo operator good practice. (0.14 seconds)

3/6/2009 12:56:39 PM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
"Being too lazy to find specific examples of it being good practice vs poor practice, I'll take the statistical approach:

Results 1 - 10 of about 447,000 for modulo good practice. (0.21 seconds)
Results 1 - 10 of about 5,980,000 for modulo bad practice. (0.33 seconds)"


oh em jesus

3/6/2009 1:24:29 PM

evan
All American
27701 Posts
user info
edit post

Quote :
"NOBODY CARES

STFU EVERYBODY"

3/6/2009 1:40:12 PM

Solinari
All American
16957 Posts
user info
edit post

Quote :
"I have, however, worked as a developer at two companies and for countless contracts, a Unix admin, a ClearCase admin, and supported a security and robustness testing initiative."


I swear... they should rename this section "Admin Talk" because it seems like there's only one or two of us who aren't network admins.

blech.

[Edited on March 6, 2009 at 1:51 PM. Reason : s]

3/6/2009 1:41:30 PM

joe_schmoe
All American
18758 Posts
user info
edit post

TIBERIUS I WANT YOU TO POST YOUR LINKED IN ACCOUNT IMMEDIATELY


































because i want to join your professional network.

let's be friends again.

i miss the days we used to hang out and shit.








[Edited on March 6, 2009 at 1:59 PM. Reason : ]

3/6/2009 1:57:43 PM

confusi0n
All American
5076 Posts
user info
edit post

Quote :
"
I swear... they should rename this section "Admin Talk" because it seems like there's only one or two of us who aren't network admins.
"


which is ever so hilarious because Tiberius fits the stereotype of "self-important overcompensating sysadmin" so perfectly. How does it feel to be competing with Wake Tech grads on a day to day basis ?

3/6/2009 2:02:15 PM

Solinari
All American
16957 Posts
user info
edit post

Quote :
"Tiberius fits the stereotype of "self-important overcompensating sysadmin" so perfectly."


Yea I actually just said basically that same thing to joe_schmoe in a PM

3/6/2009 2:05:48 PM

evan
All American
27701 Posts
user info
edit post

nobody reads the 49th post

3/6/2009 2:32:38 PM

 Message Boards » Tech Talk » Modulo operator is so HARD :( Page [1] 2 3 4, Next  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.