home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
library
/
pb
/
library2
/
using.fix
< prev
next >
Wrap
Text File
|
1994-04-11
|
2KB
|
42 lines
If you've been having any difficulty with the PRINT USING statement,
it may be because the definition of one format character has changed
since Turbo Basic #1.0/1.1. In Turbo Basic, putting a minus sign at
the beginning of a numeric format string (PRINT USING "-##.##";-99)
causes a negative number to be printed with a leading minus sign
(-99.00).
This was, unfortunately, a bug, and a difference from the original
definition in IBM's BASICA. While the bug has been fixed in
PowerBASIC, the description of PRINT USING in the PowerBASIC manual
has not, leading you to believe that the buggy operation in Turbo
Basic is the correct operation in PowerBASIC. Sorry we blew it on the
manual, but at least PRINT USING now works correctly in PowerBASIC.
Luckily, it's VERY easy to correct! If you encounter this problem,
just change the leading minus sign to a pound sign, and everything
will work as it did before in Turbo Basic. For example:
PRINT USING "-##.##"; n becomes PRINT USING "###.##"; n
That's all there is to it. There are several errors in the
description of the PRINT USING statement on page 225 of the Reference
Guide. The first paragraph, "Signed format," should read:
"A plus sign at the beginning of the format string causes the number's
sign (+ or -) to be printed before the number. A minus sign at the
beginning of the format string does not have this effect; it is
treated as a literal character and will always be displayed,
regardless of the sign of the number. If you place a plus sign at the
end of the format string, the number's sign is printed immediately
following the number. A minus sign at the end of the format string
causes a trailing space to be printed if the number is positive, or a
trailing minus sign if the number is negative."
In the box containing example values, format strings, and output, the
last two lines (value = 99 and value = -99) should be replaced with:
99 ##.##- 99.00 (1 trailing space)
-99 ##.##- 99.00- (no trailing spaces)
Kurt Inman (PowerBASIC R&D)