Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way with the ABS() to show % of the differenc
Message
De
02/11/2000 17:48:59
 
 
À
02/11/2000 14:50:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00437296
Message ID:
00437441
Vues:
33
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform