Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way with the ABS() to show % of the differenc
Message
From
13/11/2000 09:27:19
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00437296
Message ID:
00440965
Views:
16
>>>>>>I want to get the abs(num1 - num2).. and have the result
>>>>>>be a percent..for example...
>>>>>>?abs(12-14)... the result is 2, but what percent is 2 of the two numbers?
>>>>>
>>>>>The larger or the smaller? For the range of non-negative real numbers:
>>>>>
>>>>>? 100*ABS(a-b)/MAX(a,b) && % larger
>>>>>? 100*ABS(a-b)/MIN(a,b) && % smaller
>>>>>
>>>>>The math changes when you encompass negative numbers treating size as their scalar distance from 0 (you need to use ABS(a) and ABS(b)) or you start dealing with other than real numbers.
>>>>----------------
>>>>Hi Ed...I no what you mean. I am having problems because I do have negative
>>>>numbers and NULL values. What can I do to fix this problem? ...:)
>>>
>>>Is the difference of (2,-10) 12 or 8? NULLs are handled by using NVL() to substitute a 0 value.
>>---
>>The difference is 8...thanks for your help...:)
>
>a = ABS(a)
>b = ABS(b)
>
>nDiff = ABS(a-b)
>nMinPerc = nDiff/MIN(a,b)
>nMaxPerc = nDiff/MAX(a,b)
-------------
ok thanks...:)
Robert Keith
Independent Developer
San Antonio, Texas
E-mail address:
rebelrob1@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform