|
-
Mar 3rd, 2003, 02:03 AM
#1
Thread Starter
Member
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.
-
Mar 3rd, 2003, 06:04 AM
#2
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.
-
Mar 3rd, 2003, 07:15 AM
#3
Thread Starter
Member
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.
-
Mar 3rd, 2003, 07:44 AM
#4
Fanatic Member
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)!
-
Mar 3rd, 2003, 07:55 AM
#5
Addicted Member
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.
-
Mar 3rd, 2003, 08:16 AM
#6
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)
-
Mar 3rd, 2003, 08:24 AM
#7
Addicted Member
But using <, > , abs etc is using arithemtic. I can't see a way to do it without.
Maybe it's a riddle?
-
Mar 3rd, 2003, 08:29 AM
#8
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.
-
Mar 3rd, 2003, 08:55 PM
#9
Fanatic Member
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
-
Mar 4th, 2003, 09:57 AM
#10
Hyperactive Member
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.
-
Mar 5th, 2003, 04:23 AM
#11
Fanatic Member
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 
-
Mar 5th, 2003, 04:53 AM
#12
Addicted Member
Recognising that a number is a value and then counting out the right number of balls is itself a mathematical activity.
-
Mar 5th, 2003, 09:53 AM
#13
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|