Results 1 to 13 of 13

Thread: Sum of number without arithmetic calc.

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    india
    Posts
    63

    Sum of number without arithmetic calc.

    Hi guys,
    I have a problem. I want to find whether the sum of two numbers is negative or positive without using any arithmetic calculations may be + ,* % etc... Can somebody help me. I need it urgently.
    Thank you.

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Compare the numbers and look at their signs:

    If both are positive the sum is positive.
    If both are negative the sum is negative.
    If one is positive and the other negative, then the sum will be positive if the positive number has the larger modulus, and negative if it's the negative number that has the larger modulus.
    As for the case of one or both being 0... I leave this to you.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    india
    Posts
    63
    Hi krtxmrtz,
    But still you need to subtract two number for comparing. I want to find whether sum of 2 numbers is -ve or +ve without using any arithmetic calculations that may be add,subtract ,mul,div,mod ,abs etc....Please help. I need it urgently.
    Thank You.

  4. #4
    Fanatic Member bugzpodder's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    787
    you give the two numbers two your friend, and he'll tell you which one is bigger
    Massey RuleZ! ^-^__Cheers!__^-^ Massey RuleZ!


    Did you know that...
    The probability that a random rational number has an even denominator is 1/3 (Salamin and Gosper 1972)? This result is independently verified by me (2002)!

  5. #5
    Addicted Member
    Join Date
    Nov 2002
    Posts
    155
    Why can't you use any arithmetic- I can't think of any valid business or technical reason, so this must be homework, right? What a dumb assignment.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    Originally posted by Spooner
    Why can't you use any arithmetic- I can't think of any valid business or technical reason, so this must be homework, right? What a dumb assignment.
    it certainly is...

    pmsays, what is wrong with the method that krtxmrtz posted? I cant see any reason to subtract anything! Try learning about > , < , and = (oh, and abs might help too)

  7. #7
    Addicted Member
    Join Date
    Nov 2002
    Posts
    155
    But using <, > , abs etc is using arithemtic. I can't see a way to do it without.

    Maybe it's a riddle?

  8. #8
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    When you say the sum is positive or negative, you are comparing it to 0. Why then shouldn't comparisons be allowed?

    If you can think of an alternative method to decide whether the sum is positive or negative, then maybe you could apply this method to the 2 numbers.

  9. #9
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810
    well your question already has an arithmetic sign in it

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  10. #10
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    299
    well if you wanna be technical you could convert them to strings and use Mid$ to check each char, left to right, checking for signs and digits... that wouldn't have to use any arithmetic, just a lot of boolean logic...
    If I agree with you today, don't get used to it.

  11. #11
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Talking Hmmm....

    You want to check a mathematical inequality without using maths?

    Well, if u had only integers, try this:

    Get a (large) number of red and blue balls.

    Now, for each number X, if X is negative, put down X red balls.
    if X is positive, put down X blue balls.

    When you have done this, take away pairs of blue and red balls, until you have no balls left of one colour.

    If you have only red balls left, the sum is negative
    If you have only blue balls left, the sum is positive
    If you have NO balls left, the sum is zero.

    sql_lall

  12. #12
    Addicted Member
    Join Date
    Nov 2002
    Posts
    155


    Recognising that a number is a value and then counting out the right number of balls is itself a mathematical activity.

  13. #13
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    299
    yes, counting is just as much a mathematical function as any. this is an odd assignment, try the string manipulation and see if you can get it
    If I agree with you today, don't get used to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width