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, Prev Next  
ScHpEnXeL
Suspended
32613 Posts
user info
edit post

2.00

3/6/2009 2:38:20 PM

qntmfred
retired
40726 Posts
user info
edit post

what a shameful thread

3/6/2009 2:55:53 PM

Tiberius
Suspended
7607 Posts
user info
edit post

Quote :
"which is ever so hilarious because Tiberius fits the stereotype of "self-important overcompensating sysadmin" so perfectly"


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."


I'm not currently employed as a developer or a network admin. I'm a student, in CS, with a plan of study approaching a few fairly specific problems in CS that interest me.

Now ITTT: Assumptions, sweeping generalizations, and hypocrisy. It's pretty laughable to accuse me of self-importance and overcompensation in light the frothingly obsessive douchebaggery which resulted in this thread. I'm not the one trying desperately to prop up my self-esteem by attacking others here.

I admitted my calculation was wrong and provided support from Joe's own source and several other sources regarding my other statements, which have generally been ignored in favor of massive playa hatian. I use modulo where it's appropriate -- to avoid iteration or complex tests in periodic unsigned conditionals. It's what I was attempting to do in the original post, and it was the correct approach though my logic was a bit hindered by my mental state.

I really don't care what TWW thinks about my employment history or programming background. If that's self importance, then perhaps I'm self important. I'm of the opinion that a pattern of behavior involving the selective excerption of another's posting history to fuel several day long tirades of character assassination is more indicative of ego problems than non-insistent technical confidence. By all means, however, proceed with your circle jerk.

3/6/2009 3:14:36 PM

joe_schmoe
All American
18758 Posts
user info
edit post

^^ what aspect of this thread are you thinking is most shameful?



(A) that joe_schmoe brought a Chit Chat e-peen battle in here and ranted about it in here ad nauseum?

(B) or that Tiberius defended til his last chestbeat his broken function on the basis that he's an ubar developer yet doesnt understand fundamental arithmetic operators?

(C) or that joe_schmoe still wont even shut up on page 2, even after evan has withdrawn any support he might have given earlier on Page 1

(D) or is it that Tiberius still claims modulus is bad programming style, yet simultaneously claims a depth of knowledge of modulus operations and posts WIKIPEDIA images to prove it?

(E) or that Solinari still cant resist gloating that this place is full of sysadmins and helpdesk students who act like they work for NASA?

(F) or is it that qntmfred, who by most accounts is a smart guy and generally above such pettiness, still finds himself lingering down on the floor of a retarded poop-throwing festival?


are any of these it? am i getting warm?





[Edited on March 6, 2009 at 3:27 PM. Reason : ]

3/6/2009 3:21:15 PM

qntmfred
retired
40726 Posts
user info
edit post

what can i say. i love a good poop throwing festival

3/6/2009 3:44:51 PM

Tiberius
Suspended
7607 Posts
user info
edit post

I've defended myself to "the last chestbeat" against the condescending suggestions that I've worked as a Windows desktop tech or am an inexperienced programmer, the wild and rather easily falsifiable accusations you've been throwing around in response to a single polite suggestion that you may have misinterpreted my function.

I assumed it was misinterpreted until otherwise demonstrated because I didn't give a fuck enough to rigorously test the punchline of a joke in Chit Chat. I'll be sure not to post any more jokes in Chit Chat without extensive pre-release testing.

I'm going to restate my claims regarding modulo so it's eminently clear what I've been implying:

* Ignoring the factual accuracy of the claim that I wholly misunderstand the modulo operation, you can't even begin characterize someone as an incompetent programmer due to a simple logic error involving modulo, because it's an operation with limited applications in a few specific algorithms and most generally periodic calculations, where it is superceded by other similar approaches in many cases.
* If you run into modulo more than infrequently, you're probably doing something wrong.
* If you think modulo is one of the central concepts of computer science, you're definitely doing something wrong.

[Edited on March 6, 2009 at 3:58 PM. Reason : *]

3/6/2009 3:55:29 PM

Solinari
All American
16957 Posts
user info
edit post

I just like modulo because it makes it easy to print status updates while processing eleventy billion lines

3/6/2009 4:19:59 PM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
"modulo [has] limited applications [and] is superceded by other similar approaches

If you run into modulo more than infrequently, you're probably doing something wrong.

If you think modulo is one of the central concepts of computer science, you're definitely doing something wrong"



just ... stop.

3/6/2009 4:24:36 PM

Tiberius
Suspended
7607 Posts
user info
edit post

I've decided to take a trip down memory lane, exploring my humble beginnings to locate the first verifiable contribution to a project:

11/2/98

-- gg - comm.c: get_max_players(): "random guess" was missing a ;
From: Josh McBeth <tiberius@ac.net>


#else
/* if everything has failed, we'll just take a guess */
method = "random guess";
max_descs = max_playing + NUM_RESERVED_DESCS;
#endif


Those pesky semicolons, and masked by conditional compilation! I was just starting to learn C then. If you do the math that just over 10 years ago, and I was 13 at the time. But no, Joe, you're right, I'm a desktop tech and completely new to this programming thing. It is a lot harder than crimping patch cable, perhaps you can link me to some awesome interweb tutorials?

Solinari, I didn't really mean to offend anyone who particularly liked modulo. In fact I don't particularly dislike modulo, it is an elegant solution in certain cases. It does have limited applications, but I probably understated its signifigance in attempting to stem the tide of unwarranted character assassination from joe.

^ Feel free to respond to the claim with something other than dismissal and posturing. I'd love to hear some technical discourse from the Modulo Masta himself.

[Edited on March 6, 2009 at 4:53 PM. Reason : So glad Stein caught that, my day would have been ruined!!!]

3/6/2009 4:31:21 PM

BobbyDigital
Thots and Prayers
41777 Posts
user info
edit post

i dunno about everyone else, but i've found this thread highly entertaining

3/6/2009 4:34:39 PM

Stein
All American
19842 Posts
user info
edit post

Quote :
"11/2/98"


Quote :
"If you do the math that was over 11 years ago"


Quote :
"3/6/2009"


:facepalm:

3/6/2009 4:38:34 PM

Tiberius
Suspended
7607 Posts
user info
edit post

hahaha, so I didn't actually do any math. glad you caught that Stein, life would not go on without another pointless detail being nitpicked.

I love how every point and reference I've made has been ignored, but if I approximate a date someone is there to point it out in under 30 seconds...


4:38:34 PM
4:31:21 PM
0:07:13

... 7 minutes and 13 seconds. I can only assume that means you're poring over the details and unable to find anything concrete to criticize

[Edited on March 6, 2009 at 4:58 PM. Reason : screw you guys, I'm goin' home]

3/6/2009 4:46:28 PM

Tiberius
Suspended
7607 Posts
user info
edit post

If you run into modulo more than infrequently, you're probably doing something wrong.

For argument's sake, I counted the number of occurances of modulo operations in various open source packages:

It's 4136 for 2.6.26-gentoo-r4 including false positives for, in approximately 5.2 million lines of code for 2.6.0. Considering the industry average of 3250 lines of code per year for a full-time programmer, said average programmer working on the Linux kernel would encounter the need for a modulo operation once every three to four months.

In OpenSSL-0.9.8j, a package that actually relies on modulo operations in its implementation of RSA cryptography, has ~108 modulo operators in 335k lines of code. You can apparently implement an entire RSA cryptography suite encountering approximately one modulo a year.

There are approximately 1 million lines of code in MySQL 5.1.25, and ~1151 modulo operators in MySQL 5.1.32. Here again you can expect a modulo every three to four months.

Modulo: clearly the foundation of computer science.

3/6/2009 6:04:22 PM

0EPII1
All American
42541 Posts
user info
edit post

GUIZE

CERIOSELY, THEM MOSLEMS ARE ABOUT TO TAKE OVER THE WORLD.

AND YOU GUIZE TALKING ABOUT SUM MATH???

3/6/2009 6:06:32 PM

joe_schmoe
All American
18758 Posts
user info
edit post

^^ HEY, wow, that's some nice analysis work, there. seriously.

because it underscores my point that this is even more of reason that when you DO encounter/require the modulus ... this basic arithmetic operator ... that you ought get it freaking right.

which also reminds me:

several years ago (c.2001-2002) at a previous employer I was working as a hardware verification engineer on the various crypto functions of a multimillion-gate ASIC implementation of a high-speed network security processor ... I actually discovered a fairly significant bug in the Synopsys' HVL tool, "Vera" : their random number generator was broken. as in "not random". which had significant impact on the Monte Carlo tests against our cryptographic implementations. I was later informed by a Synopsys app engineer that it was due to a typo in a MODULUS operation, which they assured me would be corrected in the next revision of Vera.


in any event, when you DO get some code wrong, you don't continue to stomp around and insist that the person who bothered to correct your code is a dumbass.

look... you say you're a CS student, right? is this what they teach you kids these days? to forgo problem solving and critical assessment of your own code in favor of chestbeating and blustering?

Do they teach you that if there are aspects of computer programming that "aren't used as much," that you don't need to worry about it? I mean, you can probably get away without using the "Divide" operator either. Who cares where the numerator and denominator go. Nobody divides anymore, it's considered obfuscated and poor programming practice.



what school do you go to, anyhow, Mr. Josh McBeth? I ask, because somehow i get the feeling you don't go to NCSU.

if you do, I'm going to be just a little bit sad.







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

3/6/2009 6:13:26 PM

Tiberius
Suspended
7607 Posts
user info
edit post

You didn't correct code, you corrected a joke.

You haven't contributed to a greater understanding of modulus, saved the world, or whatever your moral justification for being a fountain of masturbatory bullshit for the last two days pretty much your entire post history has been.

If you corrected code that impacted anything in a sane and respectful manner, I would have thanked you. Instead, you realize that you were being a fucking smartass about a joke in Chit Chat I hope? Then, you immediately started attacking me and have continued to do so for two days, "chestbeating" about an incorrect modulo calculation in... yes... you know it's coming... a joke posted in Chit Chat. If you haven't figured it out after several reptitions this is why I didn't give a fuck then and don't give a fuck now about your correction. I think you're an annoying piece of shit and the very epitome of self-importance.

Programmers do make mistakes, and that's why it's important for members of a funtional team to communicate respectfully. I can't imagine you communicate like this in your place of employment, and if you do communicate like this I can see why you're such a bitter, insecure little troll on the interwebs.

[Edited on March 6, 2009 at 7:00 PM. Reason : .]

3/6/2009 7:00:29 PM

ScHpEnXeL
Suspended
32613 Posts
user info
edit post

both of you need to just be fucking suspended for this bullshit. shut. the. fuck. up.

NOBODY CARES

3/6/2009 7:30:40 PM

Solinari
All American
16957 Posts
user info
edit post

you're right. this thread has nothing to do with the "struggles" that beset a sysadmin on a daily basis, so obviously no one cares about it

3/6/2009 7:40:34 PM

evan
All American
27701 Posts
user info
edit post

your attempt at sarcasm has failed, sir

if this were an actual discussion, then you'd be right

it's turned into an internet tuff guy fight, however, so it's utterly useless

3/6/2009 7:49:14 PM

Solinari
All American
16957 Posts
user info
edit post

oh look another sysadmin with his panties in a wad because we're not talking about pulling cat5 or how stupid "lusers" are ROFL!!!!!11!!11~

3/6/2009 7:51:16 PM

Tiberius
Suspended
7607 Posts
user info
edit post

so tuff

3/6/2009 7:51:25 PM

Hoffmaster
01110110111101
1139 Posts
user info
edit post

This thread is not all bad. I learned something that I would like to share.


.


.


.


Joe is a douche. Just because the internet allows you to be an eJackass, doesn't necessarily mean you have to be one.

3/6/2009 10:52:53 PM

Shaggy
All American
17820 Posts
user info
edit post

my operator is so hard right now

3/6/2009 11:04:27 PM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
"You didn't correct code, you corrected a joke"


funny, you didnt seem to be joking when you blindly defended it as being accurate.

3/6/2009 11:10:53 PM

evan
All American
27701 Posts
user info
edit post

^^

3/6/2009 11:15:31 PM

joe_schmoe
All American
18758 Posts
user info
edit post




[Edited on March 6, 2009 at 11:21 PM. Reason : dp]

3/6/2009 11:20:41 PM

joe_schmoe
All American
18758 Posts
user info
edit post

Quote :
"Tiberius:

"%" is not an arithmetic operator and the interpretations of modulo in Computer Science differ not only from language to language and machine to machine, but from the mathematical treatment of modular arithmetic as well.

[Edited on March 6, 2009 at 8:39 PM. Reason : ."


OMFG

SHUT THE FUCK UP ALREADY, YOU HAVEN'T EVEN GRADUATED AND YOU'RE ALREADY DEVALUING MY DEGREE





jesus christ, you DO go to Wake Tech, don't you????

3/6/2009 11:20:42 PM

evan
All American
27701 Posts
user info
edit post

can someone please lock this thread?

please?

3/6/2009 11:24:39 PM

Solinari
All American
16957 Posts
user info
edit post

here's a handy tip.... if you're tired of a thread then stop reading it and posting in it

3/6/2009 11:45:06 PM

evan
All American
27701 Posts
user info
edit post

can someone please suspend Solinari?

please?

3/6/2009 11:46:49 PM

Solinari
All American
16957 Posts
user info
edit post

3/6/2009 11:49:08 PM

dakota_man
All American
26584 Posts
user info
edit post

hahahahaha

evan pwnt, stay home

3/6/2009 11:50:04 PM

Solinari
All American
16957 Posts
user info
edit post

so getting back on topic... Is the main problem with modulo the fact that it uses the divide unit on a processor?

3/6/2009 11:57:29 PM

dakota_man
All American
26584 Posts
user info
edit post

There's no problem with it.

3/6/2009 11:58:56 PM

Solinari
All American
16957 Posts
user info
edit post

Well, I guess I'm just trying to figure out if there's anything technical that's actually worth learning from all of this...

I'm sure there is some downside to using modulo or else there wouldn't have been a fight.

3/7/2009 12:02:46 AM

dakota_man
All American
26584 Posts
user info
edit post

There shouldn't have been a fight.

3/7/2009 12:12:30 AM

evan
All American
27701 Posts
user info
edit post

^

3/7/2009 12:35:20 AM

confusi0n
All American
5076 Posts
user info
edit post

Quote :
"There's no problem with it."

Quote :
"There shouldn't have been a fight."

Quote :
"what a shameful thread"

[/thread]

3/7/2009 1:39:06 AM

smoothcrim
Universal Magnetic!
18966 Posts
user info
edit post

Quote :
"OMFG

SHUT THE FUCK UP ALREADY, YOU HAVEN'T EVEN GRADUATED AND YOU'RE ALREADY DEVALUING MY DEGREE"

you act like a computer science degree from ncsu is anything more than some smoke and mirrors for HR.

3/7/2009 8:49:34 AM

kiljadn
All American
44690 Posts
user info
edit post

Quote :
""

3/7/2009 9:35:14 AM

Wyloch
All American
4244 Posts
user info
edit post



...I was entertained.

3/7/2009 10:30:08 AM

Solinari
All American
16957 Posts
user info
edit post

This one time I tried this:


count = 0
(foreach line lines
(if (mod 1000 count) == 0 then
(printf "%d lines processed\n" count)
)
count = count + 1
)


d'oh!!

3/7/2009 10:35:13 AM

Nitrocloud
Arranging the blocks
3072 Posts
user info
edit post

#include <stdio.h>
#include <stdlib.h>

int main() {
unsigned long int num[78498] = {2}, mod = 2;
double sum = 0.0;
int i = 1, j = 0;

while (mod < 1000000) {
j = 0;
while (j < i) {
if ((mod < num[j]*num[j]) && (mod % num[j])) {
num[i] = mod;
i++;
break;
} else if (!(mod % num[j])) {
break;
}

j++;
}
mod++;
}

for (j = 0; j < i; j++) sum += num[j];

printf("Terms: %-5d Total: %-10.0f\n", i, sum);

return EXIT_SUCCESS;
}

I'm sorry, I neither commented nor documented this program, but I know it used to be the solution to Project Euler #10 until they changed the question.

3/7/2009 5:02:55 PM

Tiberius
Suspended
7607 Posts
user info
edit post

Quote :
"so getting back on topic... Is the main problem with modulo the fact that it uses the divide unit on a processor?"


there never really was a topic, just joe_schmoe shitting all over the place

however, my point has been that there is inconsistent behavior for divisors < 0 and inconsistent performance, both depending on the implementation. the former property does relate to the implementation of division in the processor, the latter is language / library dependant. it's safe to assume, though, that operations modulo 2 will pretty much always be faster when expressed in terms of bitwise operations on binary hardware. e.g. to test for evenness, (x % 2) == 0 would damn near always perform more poorly than (x (bitwise-and) 1) == 0.

further that since typical implementations have inconsistent results for half of the integeral domain, then "%" shouldn't be considered an arithmetic operator and needs to be distinguished from the modulo of modular arithmetic, which is incidentally ALSO not an arithmetic operator but an equivalence relation. in modular arithmetic, the assertion is that A ≡ B modulo N. this leads to equivalences such as -1 ≡ 2 modulo 3 -- a result you'll never see as a remainder of division. positive and negative N are also thusly equivalent in modular arithmetic, as signedness does not affect the equivalence whereas again this is implementation dependant in computing.

finally being that it's ridiculously uncommon operation critical code relying on modulo (and, obviously, all code) should be tested rather than assumed to be working because durr durr i r supar programmar never make no mistake. ironically, such a practice would have identified the error that joe_schmoe referred to in Vera, but if you buy his bullshit real programmers don't test, they "just get it right".

unfortunately these points all interfere with joe's attempts to characterize me as "LOL DUMB", so he's chosen to ignore them

[Edited on March 8, 2009 at 4:33 PM. Reason : .]

3/8/2009 4:06:59 PM

Tiberius
Suspended
7607 Posts
user info
edit post

Quote :
"it's safe to assume, though, that operations modulo 2 will pretty much always be faster when expressed in terms of bitwise operations on binary hardware. e.g. to test for evenness, (x % 2) == 0 would damn near always perform more poorly than (x (bitwise-and) 1) == 0."


TEST - Test For Bit Pattern

Usage: TEST dest,src
Modifies flags: CF OF PF SF ZF (AF undefined)

Performs a logical AND of the two operands updating the flags
register without saving the result.

Clocks Size
Operands 808x 286 386 486 Bytes

reg,reg 3 2 1 1 2
reg,mem 9+EA 6 5 1 2-4 (W88=13+EA)
mem,reg 9+EA 6 5 2 2-4 (W88=13+EA)
reg,immed 5 3 2 1 3-4
mem,immed 11+EA 6 5 2 3-6
accum,immed 4 3 2 1 2-3

IDIV - Signed Integer Division

Usage: IDIV src
Modifies flags: (AF,CF,OF,PF,SF,ZF undefined)

Signed binary division of accumulator by source. If source is a
byte value, AX is divided by "src" and the quotient is stored in
AL and the remainder in AH. If source is a word value, DX:AX is
divided by "src", and the quotient is stored in AL and the
remainder in DX.
Clocks Size
Operands 808x 286 386 486 Bytes

reg8 101-112 17 19 19 2
reg16 165-184 25 27 27 2
reg32 - - 43 43 2
mem8 (107-118)+EA 20 22 20 2-4
mem16 (171-190)+EA 38 30 28 2-4 (W88=175-194)
mem32 - - 46 44 2-4


TEST is anywhere from 10 to 44 times faster than IDIV on 486, and that's the minimum speedup assuming the language implements modulo using the remainder stored in AH.

[Edited on March 8, 2009 at 5:19 PM. Reason : .]

3/8/2009 5:05:05 PM

joe_schmoe
All American
18758 Posts
user info
edit post

oh, wow. Hey, everyone, look at Tiberius.

he can cut-and-paste from the Intel 8086 instruction set manual



and he can parrot the widely-known fact that modulus operations with even-numbered divisors are always faster when implemented as a bitwise function rather than a divide operation.

Tiberius would like to welcome us back to mid 1990's when compilers didn't automatically optimize the modulus operation at the machine code level.

too bad he cant take highly developed motivation to Google modulus facts, and apply it instead to objectively inspecting his own code when someone merely points out the fact that his backassward modulus operation was incorrect.

3/8/2009 5:30:21 PM

qntmnael
New Recruit
5 Posts
user info
edit post

what a shameful thread

3/8/2009 5:41:56 PM

Big Business
Suspended
9099 Posts
user info
edit post

yup.

its evan

I'm Big Business and i approved this message.

3/8/2009 5:42:44 PM

qntmnael
New Recruit
5 Posts
user info
edit post

no, i'm qntmnael.

3/8/2009 5:46:48 PM

Tiberius
Suspended
7607 Posts
user info
edit post

Quote :
"he can cut-and-paste from the Intel 8086 instruction set manual"


A specific question regarding modulus was asked.

Quote :
"and he can parrot the widely-known fact that modulus operations with even-numbered divisors are always faster when implemented as a bitwise function rather than a divide operation."


Please don't make me demonstrate the number of operations modulo 2 and 8 occuring in major source bases...

Quote :
"Tiberius would like to welcome us back to mid 1990's when compilers didn't automatically optimize the modulus operation at the machine code level."


Why assume the compiler is going to do the correct translation to account for your poor form, when you can perform the correct operation from the beginning? Pretty fucking stupid to assume the black box is doing the right thing. I would locate some specific examples of compilers doing the wrong thing, but I'm sure they'd either be well known or motivated Googling as well Nevermind the fact that in most compilers optimizations will not take place unless you specifically request them, while it's fairly common (and often a necessity) for code to be compiled with no optimizations and targeting i386 or i486 to maximize portability.

Quote :
"too bad he cant take highly developed motivation to Google modulus facts, and apply it instead to objectively inspecting his own code when someone merely points out the fact that his backassward modulus operation was incorrect."


I acknowledged that the modulus calculation was incorrect several days ago. What I'm debating now is whether or not the remainder of my claims were accurate. They haven't changed, and they weren't "motivated Googling" when I posted them in immediate response to your onslaught of bullshit at 3AM the other night. You dismissed them pretty much wholly without a single explanation or reference, while I've "motivatedly Googled" numerous examples to counter. You've responded to those examples with further insults and masturbation. I'm not going to bother further argument until you provide a single fucking detail to support any of the last two pages of claims.

[Edited on March 8, 2009 at 6:04 PM. Reason : .]

3/8/2009 5:50:19 PM

 Message Boards » Tech Talk » Modulo operator is so HARD :( Page 1 [2] 3 4, Prev 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.39 - our disclaimer.