Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Feature, Bug, or this just can't be true
Message
 
À
01/05/2001 10:56:41
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00501962
Message ID:
00501966
Vues:
12
>I have become the 'victim' of some unforseen behavior convering the 'VAL' function. The return from Val('1234567A') is 1234567 and the return from Val('1234567E') is 1234567 but the return from VAL('1234567E01') is 12345670. In other words, the val function interpets the letter 'E' followed by numbers as being scientific notation. Is this a feature or a bug?


It is a documented feature.

Look at the sample in the help file:
VAL( ) FunctionSee Also
SET DECIMALS | STR( ) | SYS( ) Functions Overview
[This topic is part of a beta release and is subject to change in future releases. Blank topics are included as placeholders.]

Returns a numeric value from a character expression composed of numbers.

VAL(cExpression)
Return Values
Numeric

Parameters
cExpression 
Specifies a character expression composed of up to 16 numbers. Rounding occurs if more than 16 numbers are included in cExpression. 
Remarks
VAL( ) returns the numbers in the character expression from left to right until a non-numeric character is encountered (leading blanks are ignored). VAL( ) returns 0 if the first character of the character expression isn't a number or a plus sign (+) or minus sign (-).

VAL( ) can be used to convert the character strings returned by the Visual FoxPro SYS( ) functions to numeric values.

Example
CLEAR
STORE '12' TO A
STORE '13' TO B
? VAL(A) + VAL(B)  && Displays 25.00
STORE '1.25E3' TO C
? 2 * VAL(C)  && Displays 2500.00
See Also
SET DECIMALS | STR( ) | SYS( ) Functions Overview



--------------------------------------------------------------------------------

Send feedback to Visual Studio 

© 1987-2000 Microsoft Corporation. All rights reserved.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform