PRB: STR() Returns Scientific Notation

Last reviewed: March 27, 1996
Article ID: Q126139
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
  • Microsoft FoxPro for Macintosh, versions 2.5b, 2.5c, 2.6a
  • Microsoft FoxPro for UNIX, version 2.6

SYMPTOMS

The STR() function returns a number in scientific notation.

CAUSE

The number passed to the STR() function has more than 10 digits.

RESOLUTION

Use the optional second parameter for the STR() function to specify the total number of digits to return. If this second parameter is not large enough, scientific notation will still be returned.

MORE INFORMATION

Steps to Reproduce Behavior

Type the following command in the Command window:

   WAIT WINDOW STR(1234567890123)

Note that the string returned in the wait window is: .1234E+13.

To prevent FoxPro from returning scientific notation, specify the number of digits for the STR() function to return, as in the following example:

   WAIT WINDOW STR(1234567890123,13)

For more information about changing the scientific notation used by FoxPro, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q148784
   TITLE     : How to Use UDF() to Modify Default Scientific
               Notation Format


Additional reference words: FoxWin FoxDos FoxMac FoxUnix 2.50 2.50a 2.50b
2.50c 2.60 2.60a
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 27, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.