Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compare values if some are in scientific notation
Message
From
26/05/2007 09:18:12
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
25/05/2007 13:03:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01228564
Message ID:
01228698
Views:
17
>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?

Yes, these are all numbers, no matter which notation they are written in. You can write a number as fixed decimal, hex or scientific, doesn't matter - it's still the same number.

It may be missing a few low decimals no matter how it's written (if it has them - disk space is integer, right?), so you may be out of luck if you want to check for exactly equal. You may check for "sufficiently equal", i.e. that they differ by no more than your expected margin of error. If you're comparing disk drives, your numbers are in the order of magnitude of hundreds of gigabytes, i.e. 11 digit numbers. If your numbers are precise to only six digits, then your margin of error is about one megabyte.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform