Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22538

Re: Not quite one

From Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Not quite one
Date 2014-01-07 19:06 +0000
Organization Home
Message-ID <7SJIf8aaAFzSFw8A@invalid.uk.co.demon.merlyn.invalid> (permalink)
References (1 earlier) <j0srb9l9d5n62rpi2emeqn0lv5k4pfc6bk@4ax.com> <0i8LDFD+RzvSFwfE@invalid.uk.co.demon.merlyn.invalid> <co43c91qi21egv9h6ko9iius6l96lldc70@4ax.com> <1174e951-3486-455e-b7f6-f70ebd7bfab0@googlegroups.com> <8fcbba0b-5ea1-4bf0-b1a0-d638f05ed93c@googlegroups.com>

Show all headers | View raw


In comp.lang.javascript message <8fcbba0b-5ea1-4bf0-b1a0-d638f05ed93c@go
oglegroups.com>, Mon, 6 Jan 2014 01:48:40, "Michael Haufe (TNO)"
<tno@thenewobjective.com> posted:

>On Monday, January 6, 2014 2:55:18 AM UTC-6, jonas.t...@gmail.com wrote:
>> But maybe i want to calculate Pi using geometry, and Pi turn out be a
>>poor approximation because they can not implement arithmetic.
>
>They did implement arithmetic: arithmetic on Floats, not Reals.
>
>If you want arbitrary precision arithmetic, implement it yourself or
>grab one of the plentiful libraries on the web.
>
>If you want pi with infinite precision, represent it as an object and
>use term rewriting.
>
>If you want some arbitrary digit, use the BBP formula


Perhaps you mean binary or hexadecimal digit?
<http://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_for
mula>.

I have, some while ago, implemented BBP in an RPN of my own (in which
all opcodes are T'L'As) implemented in Borland Pascal/Delphi; if you
want details, you will have to read
<http://www.merlyn.demon.co.uk/programs/longcalc.pas>, since I've
forgotten most of them : for BBP, start at line 2094-2113,
        function F_pi(var SP : PLET) : boolean ; FAR ;
        ...
          end {F_pi} ;

Numbers are integers, held as heap arrays of digits base 2..16, and the
display is of pi * base^n (otherwise the answer would be 11, 10, or 3).
The Pascal compilation allows up to about 65500 digits, the Delphi one
99999999.  There is a GUI version, too.

Example :

        DOS prompt>longcalc 5 10 15 pow #pi

        LONGCALC: www.merlyn.demon.co.uk >= 2005-07-22
         compiled with Borland Delphi.
        F_pi.
        +3,133,333,333,333,334
        +3,141,422,466,422,467
        +3,141,587,390,346,582
        +3,141,592,457,567,435
        +3,141,592,645,460,335
        +3,141,592,653,228,086

Longcalc is also useful if you want to calculate the date of Gregorian
Easter Sunday using any base in 2..16, for any year until well past the
end of the Earth.

Now if anyone has a JavaScript interpreter for Delphi ...


-- 
 (c) John Stockton, nr London UK.  ?@merlyn.demon.co.uk  DOS 3.3, 6.20; WinXP.
  Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links.
   PAS EXE TXT ZIP via  <http://www.merlyn.demon.co.uk/programs/00index.htm>
   My DOS  <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Not quite one jonas.thornvall@gmail.com - 2013-12-27 05:28 -0800
  Re: Not quite one Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-27 11:50 -0200
    Re: Not quite one jonas.thornvall@gmail.com - 2013-12-27 06:02 -0800
      Re: Not quite one "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-27 17:12 +0100
  Re: Not quite one John Harris <niam@jghnorth.org.uk.invalid> - 2013-12-27 21:24 +0000
    Re: Not quite one Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-28 20:28 +0000
      Re: Not quite one John Harris <niam@jghnorth.org.uk.invalid> - 2013-12-30 15:37 +0000
        Re: Not quite one Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-12-31 21:12 +0000
        Re: Not quite one jonas.thornvall@gmail.com - 2014-01-06 00:55 -0800
          Re: Not quite one "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-01-06 01:48 -0800
            Re: Not quite one Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-01-07 19:06 +0000
    Re: Not quite one jonas.thornvall@gmail.com - 2013-12-29 01:51 -0800
      Re: Not quite one "Michael F. Stemper" <michael.stemper@gmail.com> - 2013-12-29 15:49 -0600
        Re: Not quite one Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-29 23:06 +0100

csiph-web