J has a few different ways of representing numbers, including:

- Machine integers (limited to 64 or 32 bit); this is what you get if you type 
a number like 123

- Machine floating-point numbers (limited precision, but can have decimal 
points in them); this is what you get if you type a number like 3.45 or 1p1

- Extended-precision numbers (unlimited precision, but can only represent 
integers and rational numbers); this is what you get if you type a number like 
123x or 3r4

You would like an unlimited-precision representation of pi, I assume. But the present implementation of j is incapable of this; the only things it can represent with unlimited precision are integers and rational numbers, and pi is irrational.

Machine representation of irrational numbers is a very interesting topic, but it is fraught with tradeoffs and complexities, and the present implementation of j does not attempt it. As far as I know, all implementations of apl have the same limitation; there, too, ○1 is a floating-point approximation. And I do not think most apl implementations even have extended-precision integers or rational numbers.

You might like to look into computer algebra systems (cas), such as mathematica.

On Sun, 15 May 2022, yt wrote:


 Dear All,
 i come back to start in J

 in jijx>tour>overview
     3p5       NB. Pi (3 * Pi ^ 5)
 918.059

 may be it is not the better way to find Pi :
     1p1       NB. Pi (1 * Pi ^ 1)

     1p1
 3.14159
     1p1x
 |ill-formed number
 |      1p1x
 |      ^

 but this is ok for :
     ^/ 2 3 4
 2.41785e24
     ^/ 2 3 4x
 2417851639229258349412352
     3^4
 81
     2^81
 2.41785e24
     2^81x
 2417851639229258349412352

 why 1p1 is not good ?

 i have not this problem in APL

 Sorry for the inconvenience
 Regards,
 Yves
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to