Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LEN() for numeric expresions
Message
De
30/10/2002 12:33:32
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00716929
Message ID:
00716968
Vues:
19
Larry,Steve,Héctor ;-)

FWIW, you could use PADR() which respects the decimals and also works in prior versions of VFP:
x = 456.461
x = x + .0010
? x   && Prints 456.4620
? transform(x)  && Prints 456.462 in VFP6
?ALLTRIM(PADR(x, 20)) && Prints 456.4620 in VFP6
>Steve/Héctor,
>With VFP 7 SP1, the precision is stored by VFP and using transform doesn't change it.
>
>x = 456.461
>x = x + .0010
>? x   && Prints 456.4620
>? transform(x)  && Prints 456.4620 again
>VFP will do this until it reaches it reaches its limit of 16 digits of precision (combination of whole and decimal values).
>
>HTH.
>
>>Héctor,
>>
>>Thats a tricky question. For example:
>>
>>
>>x = 456.4618
>>x = x + .0002
>>? x   && x = 456.4620  this is still 4 decimals
>>
>>
>>I don't really see how it can be done, because the x in the above example is accurate to the ten-thousandths position. Any attempt to use a function such as MOD() or TRANSFORM() to determine the precision would indicate that it is only accurate to the thousandths position.
>>
>>Of course determining the length to the left of the decimal is a piece of cake.
>>
>>I'm curious...what do you need this information for?
>>
>>>Hi, I need to make a function wich returns the lenght of a numeric expresion. Lets say that I have a number, 456.4618 and I want to know how many integers and decimals positions there are. This function must return that there are 3 integers and 4 decimals.
>>>
>>>Any idea?
>>>
>>>Thanks
Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform