INPUT X% Statement Gives No "Type Mismatch" for d, e, !, or # (31273)






This article was previously published under Q31273

SYMPTOMS

A "Type Mismatch" error does not occur if the INPUT statement receives any of the following noninteger-type symbols in an integer variable:

  1. d (double-precision exponential)
  2. e (exponential)
  3. ! (single-precision exponential)
  4. # (double-precision exponential)
Instead, a value of 0 (zero) is input. QuickBasic automatically converts the noninteger-type symbol to zero (0) instead of giving a "Type Mismatch" error message.

STATUS

Microsoft has confirmed this to be a bug in QuickBasic versions 3.00, 4.00, 4.00b, and 4.50 for MS-DOS; in Microsoft Basic Compiler versions 6.00, 6.00b for MS-DOS and MS OS/2; in Microsoft Basic Professional Development System versions 7.00 and 7.10 for MS-DOS and OS/2; and in Microsoft GW-Basic Interpreter versions 3.20, 3.22, and 3.23 for MS-DOS. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

NOTE: The "Type Mismatch" error message occurs in the above products, except for Basic PDS 7.00 and 7.10, if you input only a percent sign ("%", which marks integer constants) in response to INPUT for an integer variable. In Basic PDS 7.00 and 7.10, a % is correctly input with a value of zero.

The following code demonstrates the above problem:
' A value of zero is input if the following noninteger-type
' characters are input into an integer variable: d (double exponential),
' e (single precision exponential), !, and #
INPUT "ENTER AN INTEGER ",i%
PRINT i%
END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB31273