Format anomaly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Format anomaly

Chip Davis-2
I ran across the following apparently anomalous behavior in the Format()
BIM (Built-In Method).  It may already be addressed and fixed in a later
drop, but I'm in the middle of development and didn't want to mess with a
nicely working system.  The webdocs at Hursley didn't seem to have any
mention of this problem (if it _is_ one; the odds are I'm just missing
something fundamental) unless that's what was meant by "formatting
improvements".

[N:\nrx]type testformat.nrx
/* testformat.nrx - test Format() anomaly */
dollars = 1.5
say '$'dollars.format(null,2)
say '$'1.5.format(null,2)
say '$'150/100.format(null,2)
cents = 150
hund = 100
say cents/hund
say '$'cents/hund.format(null,2)

[N:\nrx]nrc -run testformat.nrx
NetRexx portable processor, version 1.113
Copyright (c) IBM Corporation, 1997.  All rights reserved.
Program testformat.nrx
Compilation of 'testformat.nrx' successful
Running testformat ...
$1.50
$1.50
$1.5
1.5
$1.5

[N:\nrx]java -version
JAVA.EXE version "JDK 1.1.1 IBM build o111-19970726"

On the same topic, I was confused by the third paragraph under "Format"
(TNL p.156) which states in part:

   "If either of these [arguments] is omitted, or is null, the number
   of characters used will be as many as are needed for that part."

This led me to try "foo = bar.format(,2)" as one would have done in
Classic Rexx.  Only after reading the subsequent section (which only
applies to exponential notation) did I read:

   "The default for any of the arguments may be selected by omitting
   them (if there are no more arguments to be specified to their right)
   or by using the value null."

Since the exponential notation section refers back, by saying "The first
two arguments are as already described", I suggest the latter sentence
replace the former in TNL, 2nd edition.

-Chip-  Member of Rexx Language Association & TeamOS/2 & Thoroughly Warped!
Aresti Systems  POB 13306  Research Triangle Pk NC 27709-3306  919.303.3306
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>