I was REALLY bad at math in school, so here's a simple question.
How do you find out how close one number another number?
-17 is how many numbers different from 31?
I have no clue how to do this.
And if there are any procs for this, point them out to me, please.
Thanks in advance.
ID:154197
Apr 12 2002, 7:30 am
|
|
Foomer wrote:
I was REALLY bad at math in school, so here's a simple question. Well, you just plug the numbers into a 3 dimensional distance formula: dist = sqr((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2) with the same y and z values for each point. Heh, you can go that route, but it simplifies to dist = abs(x1-x2) on a one dimensional number line. The distance from -17 to 31 is 48. |
Foomer wrote:
I was REALLY bad at math in school, so here's a simple question. It's called subtraction, and it's built right into BYOND! :-) 31 - (-17) = 48 probably best to use abs() so id doesn't matter which one is listed first: proc/difference(num1, num2) return abs(num1 - num2) |
That's absolute value: abs(x). That's equal to the distance of a number from 0, basically (i.e., it takes a number and chops off a negative sign, if there is one). So the distance between two numbers would be abs(x-y).
Lummox JR