> 1. There is no way to request exponential formatting with no fractional
> digits. In previous releases __ ": 10 would format to 1e1, but in 6.02
> it is a domain error. (__j.0) doesn't work either.
In x ": y, the complex number x is interpreted as w j. d where
the real part is w and |w is the width and the imaginary part is d
and |d is the number of decimal places. When x is __,
the width is |__ or _, surely an error?
I note that (for example),
_5 ": 12345
1e4
an exponent format with 0 decimal places ("no fractional digits").
Regarding point 0, the dictionary also says that "if w is zero",
enough space is allocated." And that is what it does:
0j_5 ": 123 56789
1.23000e2 5.67890e4
----- Original Message -----
From: Henry Rich <[email protected]>
Date: Wednesday, January 20, 2010 15:41
Subject: [Jprogramming] ": does not conform to DoJ WAS: problem with e and g
fields in printf
To: Programming forum <[email protected]>
> I checked this out to fix it but there are two issues:
>
> 0. The 'bug fix' Roger made for 6.01 means that now the
> code does not
> conform to the Dictionary, which says (for ":):
>
> Otherwise (if w<0 or d<0), the result is put in
> exponential form (with
> one digit before the decimal point) and is left-justified except
> for two
> fixed spaces on the left (including one for a possible negative sign).
>
> The two fixed spaces have been removed.
>
> 1. There is no way to request exponential formatting with
> no fractional
> digits. In previous releases __ ": 10 would format to 1e1,
> but in 6.02
> it is a domain error. (__j.0) doesn't work either.
>
> Can this be put back the way it used to work (and
> documented in DoJ)?
> Otherwise there is no way to format exponentials with no
> fraction.
>
>
> I am going leave printf unchanged until this is resolved.
>
> Henry Rich
>
>
> Tom Arneson wrote:
> > Something happened to break the e field specification in
> sprintf from
> > printf.ijs
> >
> >
> >
> > '%0.2e'sprintf 1e_4
> >
> > .00e-4
> >
> > '%f'sprintf 1e_4
> >
> > 0.000100
> >
> > '%g'sprintf 1e_4
> >
> > 0.000100
> >
> > '%e'sprintf 1e_4
> >
> > .000000e-4
> >
> > '%5.1e'sprintf 1e_4
> >
> > .0e-4
> >
> >
> >
> > The following is from the Test Lines
> >
> > ': 5.500000e0:' -: ':%e:' sprintf 5.5
> >
> > 0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm