[Jprogramming] Questions on precision
Devon McCormick
devonmcc at gmail.com
Wed Oct 12 00:06:12 HKT 2011
J has rational numbers, so "1r3" is like "1x/3x" - a ratio of extended
precision integers (stored as a pair of extended integers).
The trick is using a format statement - like 0j60": - to print, in this
case, 60 decimal digits.
On Tue, Oct 11, 2011 at 11:59 AM, David Vaughan <
purpleblues13 at googlemail.com> wrote:
> How do these work?
>
> Is it possible to get arbitrary precision this way?
>
> On 11 Oct 2011, at 16:52, Roger Hui wrote:
>
> > 0j60 ": 1r3
> > 0.333333333333333333333333333333333333333333333333333333333333
> >
> > 0j60 ": (+%)/ 200 $ 1r1
> > 1.618033988749894848204586834365638117720309179805762862135449
> >
> > 0j60 ": -:@(+ 2&%)^:6 ] 1r1
> > 1.414213562373095048801688724209698078569671875377234001561013
> >
> >
> >
> > ----- Original Message -----
> > From: Raul Miller <rauldmiller at gmail.com>
> > Date: Tuesday, October 11, 2011 8:44
> > Subject: Re: [Jprogramming] Questions on precision
> > To: Programming forum <programming at jsoftware.com>
> >
> >> On Tue, Oct 11, 2011 at 11:09 AM, David Vaughan
> >> <purpleblues13 at googlemail.com> wrote:
> >>> I know you can get exact precision with x:, but what about
> >> getting a lot a decimal points?
> >>> e.g.
> >>> 1%3
> >>> 0.333333
> >>>
> >>> Can this become
> >>>
> >>> 0.333333333333...?
> >>
> >> Yes.
> >>
> >> Edit->Configure...
> >> Parameters: Print Precision
> >> 12
> >>
> >> Or, http://www.jsoftware.com/help/dictionary/dx009.htm:
> >> 9!:11]12
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
More information about the Programming
mailing list