Microsoft KB Archive/25993

= &quot;Type Mismatch&quot; Using PRINT VAL(&quot;100.1 %&quot;) or VAL(&quot;E%&quot;) =

Article ID: 25993

Article Last Modified on 11/21/2006



This article was previously published under Q25993



SUMMARY
A &quot;Type Mismatch&quot; error occurs for the PRINT VAL(&quot;100.0 %&quot;) statement, because the percent (%) symbol can be appended only to integer constants, and 100.0 is a floating-point constant. Basic notices the &quot;%&quot; symbol despite its separation with a space from the floating-point constant 100.0.

&quot;Type Mismatch&quot; also properly occurs for PRINT VAL(&quot;E%&quot;) and PRINT VAL(&quot;D%&quot;), where &quot;E&quot; represents single-precision exponential notation, and &quot;D&quot; represents double-precision exponential notation.

The following statements print 100.0 without error: PRINT VAL(&quot;100.0 *&quot;) PRINT VAL(&quot;100.0 !&quot;) PRINT VAL(&quot;100.0 #&quot;) This behavior occurs in Microsoft QuickBasic Versions 4.00, 4.00b, 4.50 for MS-DOS, and in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2.

Please note that QuickBasic Version 3.00 and Microsoft GW-Basic Versions 3.20, 3.22, and 3.23 fail to give an error for the statement PRINT VAL(&quot;100.0 %&quot;).

Additional query words: QuickBas BasicCom

Keywords: KB25993

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.