Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert string 1/4 or 1/2 to numeric
Message
De
19/01/2016 11:41:48
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
19/01/2016 11:12:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01629854
Message ID:
01629941
Vues:
52
>>Edit: Protip
>>The count of 2 you have to use is in the number of decimal places.
>>n places means divide by 2^n
>
>Clever, clever, Lutz.
>How did you figure that one out?

Bill,

simple. To much binary - hex - deci conversation

10 is only divisible (whole numbers, as daughter says behind me) by 2 and 5

0.1 is a tenth. A half times a fifth. IOW it's (2^-1)*(5^-1)
You can put one half (2^-1) into it > 0.5
0.01 is a tenth times a tenth, IOW (2^-1)*(5^-1)*(2^-1)*(5^-1)=(2^-2)*(5^-2)
You can put one quarter (2^-2) into it > 0.25; (0.5); 0.75
....

There shoud be a way using LOG10() without counting numbers, but I'm to lazy right now. (For the whole part it's INT(log10(ABS(EVL(INT(tnNumber),1))))+1 )
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform