DIETER ENSSLEN wrote:
> sorry, can you be a tiny bit more specific with a little complete example
> of how to get a  few significant figures of pi for example printed out?
>
> pi=:(2:+j.     what is the etc  etc  etc that will get pi to 10
> significant digits for example and would it be a real number i could work
> with?
>
> so what does J work with internally, 16 significant digits normally??

J normally uses 64-bit floating point numbers for real values.  However,
it can also represent large integers and rational numbers and calculate to
arbitrary precision.  See

http://www.jsoftware.com/jwiki/Essays/Extended Precision Functions

For example:

DP=: 40

pi=: DP&$: : (4 : 0)
 b %~ (x:!.0 y) * <....@o. b=. 10x^x+>.10^.>./|y
)

   0j40": pi 1
3.1415926535897932384626433832795028841971

gives pi to 40 decimal places.  The noun pi 1 is a rational number
representing pi to 40 decimal places and can be used further in
calculations.

Best wishes,

John

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

Reply via email to