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
02/11/2000 17:48:59
 
 
To
02/11/2000 14:50:50
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00437296
Message ID:
00437441
Views:
27
>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.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform