Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare values if some are in scientific notation
Message
From
25/05/2007 16:39:56
 
 
To
25/05/2007 13:13:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01228564
Message ID:
01228603
Views:
21
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")
>
Previous
Reply
Map
View

Click here to load this message in the networking platform