Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare values if some are in scientific notation
Message
De
25/05/2007 16:39:56
 
 
À
25/05/2007 13:13:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01228564
Message ID:
01228603
Vues:
13
The comparison of evaluate would work but since I need to convert all numbers to since I have to either convert all numbers to strings I am not sure it is shorter than what I am doing now.

>>I need to compare values some of which are in scientific notation (for example available disk space on two drives). The best I could come up with is to
>>
>>1. use the transform function to be sure all values are in scientific notation
>>2. get the value of the exponents
>>3. get the value of the mantissa
>>4. compare the exponents and if needed the value of the mantissa
>>
>>Is there a better way?
>>
>>TIA
>
>Can't you compare them directly? For example:
>
>? 500 < 2e6
>
>
>If the values are stored as texts, you can use val() to convert the individual values to numbers, or alternatively eval(), for example:
>
>
>? eval("5e6") < eval("2e7")
>* or even
>? eval("5e6 < 2e7")
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform