It finally became obvious that numeric data isright justfied and character data
bases are normally left justified. I always used $ when I wondered if an
array was literal or numeric data.
]N=: 3 5$(?.10000)%>:i.7
6146 3073 2048.67 1536.5 1229.2
1024.33 878 6146 3073 2048.67
1536.5 1229.2 1024.33 878 6146
]D=: 0j3 ":3 5$(?.10000)%>:i.7
6146.000 3073.000 2048.667 1536.500 1229.200
1024.333 878.000 6146.000 3073.000 2048.667
1536.500 1229.200 1024.333 878.000 6146.000
Thanks for the "easy" format.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Don Guinn
Sent: Friday, August 01, 2014 8:45 AM
To: Programming forum
Subject: Re: [Jprogramming] FW: zero is an integer
If you want an array of numbers to align along decimal points you can use
": .
0j5":at2 /~ i:3
_2.35619 _2.55359 _2.81984 3.14159 2.81984 2.55359 2.35619
_2.15880 _2.35619 _2.67795 3.14159 2.67795 2.35619 2.15880
_1.89255 _2.03444 _2.35619 3.14159 2.35619 2.03444 1.89255
_1.57080 _1.57080 _1.57080 0.00000 1.57080 1.57080 1.57080
_1.24905 _1.10715 _0.78540 0.00000 0.78540 1.10715 1.24905
_0.98279 _0.78540 _0.46365 0.00000 0.46365 0.78540 0.98279
_0.78540 _0.58800 _0.32175 0.00000 0.32175 0.58800 0.78540
The default display is for trailing zeros to be suppressed. Columns align
but within each column the number display is right aligned.
Maybe 8!:x (format) can display the numbers more to your liking.
On Thu, Jul 31, 2014 at 10:15 PM, Linda Alvord <[email protected]>
wrote:
> I sent this to New Zealand by mistake.
>
>
>
> From: Linda Alvord [mailto:[email protected]]
> Sent: Tuesday, July 29, 2014 9:29 AM
> To: ([email protected])
> Subject: zero is an integer
>
>
>
> Here is a numerical data array. Since 0 is an integer, shouldn't it be
> aligned under the three in the last 4 rows?
>
>
>
> at2=: 13 :'([:{:"1 *.) j./"1 y'
>
>
>
> at2 /~ i:3
>
> _2.35619 _2.55359 _2.81984 3.14159 2.81984 2.55359 2.35619
> _2.1588 _2.35619 _2.67795 3.14159 2.67795 2.35619 2.1588
> _1.89255 _2.03444 _2.35619 3.14159 2.35619 2.03444 1.89255
> _1.5708 _1.5708 _1.5708 0 1.5708 1.5708 1.5708
> _1.24905 _1.10715 _0.785398 0 0.785398 1.10715 1.24905
> _0.982794 _0.785398 _0.463648 0 0.463648 0.785398 0.982794
> _0.785398 _0.588003 _0.321751 0 0.321751 0.588003 0.785398
>
>
>
> I'm not sure it is possible, but the table would be much easier to read.
>
>
>
> Lindaa
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm