Thread: Calculating S in C task

  1. #16
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    <hands in ears> lalalaalalalalalalalalalalalala

    Who cares? We were talking about something completely different!

    you have been offtopic all day dude. I was talking about the maximum value held by a long, and you were talking about another way to produce large values.
    That program that produces factorials up to 100 was done under 10 lines of C code on a machine that is running Linux with a 32 bit processor.

  2. #17
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    That program that produces factorials up to 100 was done under 10 lines of C code on a machine that is running Linux with a 32 bit processor.
    I am sure it was. I am also certain it wasn't holding those values in a variable of type LONG.

    I am also quite confident you stumbled upon it snooping through 'your co-worker's email'.

  3. #18
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    That's the smartest thing you said all day. The next thing is for you to learn how to apply it. I didn't call you any names. You just don't have enough friends obviously.
    I was able to produce numbers for large values. All you seem to be capable of producing is a lot of hot air. Now shut it and try to learn something for once.
    Last edited by Overworked_PhD; 04-20-2010 at 06:49 PM.

  4. #19
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    I am sure it was. I am also certain it wasn't holding those values in a variable of type LONG.

    I am also quite confident you stumbled upon it snooping through 'your co-worker's email'.
    No, I didn't get it from my co-workers email you dimwit. Try again.

  5. #20
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    I was able to produce numbers for large values. All you see to be capable of producing is a lot of hot air. Now shut it and try to learn something for once.
    Yes, we all know you are the most capable C programmer here. Now off you go, treat yourself to some milk and cookies or something.

  6. #21
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by claudiu View Post
    Yes, we all know you are the most capable C programmer here. Now off you go, treat yourself to some milk and cookies or something.
    No. But I know than I'm more capable than you.

  7. #22
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Overworked_PhD View Post
    That program that produces factorials up to 100 was done under 10 lines of C code on a machine that is running Linux with a 32 bit processor.
    Prove it. Don't post your output. Post your ten lines.
    Quote Originally Posted by claudiu View Post
    Also, in my experience factorial(14) exceeds long int on 32bit systems.
    Quote Originally Posted by Overworked_PhD View Post
    You have no clue what you are talking about buddy. Here is what I get on my 32 bit PC. Please note that I'm not using any kind of multiprecision library.
    You're an idiot.


    Quzah.
    Hope is the first step on the road to disappointment.

  8. #23
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by quzah View Post
    Prove it. Don't post your output. Post your ten lines.You're an idiot.


    Quzah.
    Uh.... My IQ drops 10 points every time I read one of you responses. Actually, I think my IQ drops 20 points when I read your vain attempt at C code. I guess I would be really surprised if you held a job beyond IT tech support. But whatever. I don't know you in real life.
    Last edited by Overworked_PhD; 04-20-2010 at 07:01 PM.

  9. #24
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Overworked_PhD View Post
    Uh.... My IQ drops 10 points every time I read one of you responses. Actually, I think my IQ drops 20 points when I read your vain attempt at C code. I guess I would be really surprised if you held a job beyond IT tech support. But whatever.
    So in other words: "I'm a troll, please ban me, because all I'm going to do is say I can do everything under the sun, but when someone calls me on it, I'm going to act elitist and not actually do what I say I can do."

    Great, glad to see you go MisterC. Again.


    Quzah.
    Hope is the first step on the road to disappointment.

  10. #25
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by Overworked_PhD View Post
    Uh.... My IQ drops 10 points every time I read one of you responses. Actually, I think my IQ drops 20 points when I read your vain attempt at C code. I guess I would be really surprised if you held a job beyond IT tech support. But whatever.
    Oh noes!!! Your IQ dropped to negative dude!

  11. #26
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Overworked_PhD View Post
    Code and results speak louder that name calling. Just remember that before you fire off another moronic statement.
    You're missing the point. We're not talking about results that you MIGHT receive. Nor are we talking about the results that you DID receive.

    We're talking about what ANYONE with a standard C compiler, can expect to work, for large integral values.

    That upper limit is included in limits.h, and is generally defined as ULONG_MAX, or MAX_ULONG, or a similar name. If you have long long's, then look for that limit's definition, of course.

    Awhile back, I worked with a poster to find the highest range of several types of numbers, and all the integral types larger than 8 bits, (char's and shorts on my system), could be run up above their limits as listed in the header. In some cases, by quite a bit. But that doesn't mean they're safe to use, on other compilers which are set to that same C standard.

    If you go beyond the limits set by the standard, (which will almost always be quite conservative), you can not defend that decision, to a customer, to a court, or anyone else. If it works for you, fine, but that is a long way from being able to say "it's ANSI/standard C".

    Personally, I think it's fun to go exploring those unexplored niche's in C, once in awhile, as long as we're clear that it is outside the limits of standard C.

  12. #27
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak View Post
    You're missing the point.
    Nah, he's a troll.
    We're talking about what ANYONE with a standard C compiler, can expect to work, for large integral values.

    That upper limit is included in limits.h, and is generally defined as ULONG_MAX, or MAX_ULONG, or a similar name. If you have long long's, then look for that limit's definition, of course.

    Awhile back, I worked with a poster to find the highest range of several types of numbers, and all the integral types larger than 8 bits, (char's and shorts on my system), could be run up above their limits as listed in the header. In some cases, by quite a bit. But that doesn't mean they're safe to use, on other compilers which are set to that same C standard.
    I don't care what "32 bit PC" he says he has, he's not getting 158-digit numbers using any single standard unit. He's not even getting remotely close to that with 128-bit numbers. And that IS what he started going on about--storing that value in a 32 bit data type.

    Like I said, he needs to put up (post his "10 lines of C"), or shut up. Looks like he opted for the latter.


    Quzah.
    Last edited by quzah; 04-20-2010 at 07:20 PM.
    Hope is the first step on the road to disappointment.

  13. #28
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Quote Originally Posted by Adak View Post
    You're missing the point. We're not talking about results that you MIGHT receive. Nor are we talking about the results that you DID receive.

    We're talking about what ANYONE with a standard C compiler, can expect to work, for large integral values.

    That upper limit is included in limits.h, and is generally defined as ULONG_MAX, or MAX_ULONG, or a similar name. If you have long long's, then look for that limit's definition, of course.

    Awhile back, I worked with a poster to find the highest range of several types of numbers, and all the integral types larger than 8 bits, (char's and shorts on my system), could be run up above their limits as listed in the header. In some cases, by quite a bit. But that doesn't mean they're safe to use, on other compilers which are set to that same C standard.

    If you go beyond the limits set by the standard, (which will almost always be quite conservative), you can not defend that decision, to a customer, to a court, or anyone else. If it works for you, fine, but that is a long way from being able to say "it's ANSI/standard C".

    Personally, I think it's fun to go exploring those unexplored niche's in C, once in awhile, as long as we're clear that it is outside the limits of standard C.
    Yeah, I'm pretty sure the code would bork if the person ran this code on a Windows 3.1 with a 16 bit processor.

  14. #29
    Banned
    Join Date
    May 2007
    Location
    Berkeley, CA
    Posts
    329
    Adak, can I email you the code? I still think that it will compile and run correctly on any machine that has a standard C compiler. That is, I believe it is fully conforming code. However, getting a second opinion from someone that knows that they are doing doesn't hurt. I'll also have to probably include some notes because I don't think my line of reasoning is that obvious.
    Last edited by Overworked_PhD; 04-20-2010 at 09:11 PM.

  15. #30
    Registered User
    Join Date
    May 2008
    Location
    Australia
    Posts
    230
    Overworked_PhD is an idiot
    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-31-2007, 11:40 AM
  2. Where do a task get "wakeuped", blocked, preempted?
    By micke_b in forum Linux Programming
    Replies: 4
    Last Post: 12-28-2007, 04:49 PM
  3. A Task Buffer for storing socket descriptors
    By cloudy in forum Networking/Device Communication
    Replies: 0
    Last Post: 09-09-2006, 01:08 PM
  4. Calculating : high numbers
    By MiraX33 in forum C++ Programming
    Replies: 9
    Last Post: 06-08-2006, 11:08 PM
  5. Recursion
    By Lionmane in forum C Programming
    Replies: 11
    Last Post: 06-04-2005, 12:00 AM