Forth MP Code? Pi Day.

forth

    Next

  • 1. FORGET
    Dnia 18.05.2010 Anton Ertl < XXXX@XXXXX.COM > napisaa: >>> Seems to be one of most basic words... >> >> Not really. It's not in CORE, and it was deemed obsolescent (to be >> removed from the standard). It has a significant number of fans, but >> that does not make it basic. After some time flew already, I would to mention, that FORGET indeed is helpful at least in quick-trying modification of the created words - it's simply more convenient to temporarily "overwrite" the word under creation - or while "polishing" - and then decide, whether new version is better, or there's a need for FORGET, to get back to the old one. Theoretically MARKER makes the same thing, but only requiring planning in advance - and it's about this "only": while using FORGET I'm able even to "stack" several newer "versions" of word one-on-another, without this I've got to "mark" each step; indeed it's less convenient. FORGET seems to be "increasing interactivity". If possible - and not requiring serious amount of implementation time - it could be worthy to keep it for (current and future) novice Forthers. >> I have not used it in 20 years. As experienced Forth-programmer - you don't have to anymore. ;) -- Zbigniew
  • 2. EDIT
    What's the stack signature for EDIT (to invoke the built in block editor). I'm basically working to Forth-83 standards, but EDIT is of course not part of the standard. I guess it could be either: EDIT ( address -- ) or EDIT ( block -- ) Currently, my version is the former, and partners with BLOCK: 50 BLOCK EDIT I'd kind of prefer just 50 EDIT I guess I could just make a new word? : ED ( block -- ) BLOCK EDIT ; Mark

Re: Forth MP Code? Pi Day.

Postby datajerk » Tue, 17 Mar 2009 03:59:29 GMT



Doh!  Sorry, change the first drop in mpdiv to 2drop and change the
2drop in mpatan to drop.


I Googled "multiple precision forth", didn't think to try bignum.  I
checked out the first link.  It has the basics and is a good place to
start.  But, I was really hoping for a fast multiply (FFT or
Karatsuba).  I'll keep looking.

Thanks.

Re: Forth MP Code? Pi Day.

Postby Richard Owlett » Tue, 17 Mar 2009 04:33:04 GMT





Like  http://www.**--****.com/ 
and  http://www.**--****.com/ 
and  http://www.**--****.com/ 

Easy to find if you not only know it exists but where also ;}
Enjoy


Re: Forth MP Code? Pi Day.

Postby datajerk » Tue, 17 Mar 2009 05:37:23 GMT







Thanks.  A great place to start.

Similar Threads:

1.Forth MP Code? Pi Day.

datajerk < XXXX@XXXXX.COM > writes Re: Forth MP Code?  Pi Day.

> Hello Fellow Forth Programmers,

> I am looking for Forth code that does multiprecision math.  I've
> written my own, but as a Forth novice I'd like to see what others have
> done.

Your example code leaves 393 on the stack.

FORTH> STORMER A MPPRINT CR 3.
141592653589793238462643383279502884197169399375105820974944592307816406286208
998628034825342117067982148086513282306647093844609550582231725359408128481117
450284102701938521105559644622948954930381964428810975665933446128475648233786
783165271201909145648566923460348610454326648213393607260249141273724587006606
315588174881520920962829254091715364367892590360011330530548820466521384146951
941511609433057270365759591953092186117381932611793105118548074462379962749567
351885752724891227938183011949129833673362440656643086021394946395224737190702
179860943702770539217176293176752384674818467669405132000568127145263560827785
771342757789609173637178721468440901224953430146549585371050792279689258923542
019956112129021960864034418159813629774771309960518707211349999998372978049951
059731732816096318595024459455346908302642522308253344685035261931188171010003
137838752886587533208381420617177669147303598253490428755468731159562863882353
787593751957781857780532171226806613001927876611195909216420198938
 ok
[1]FORTH> .s
  Data: 393 ---
System: ---
 Float: --- ok
[1]FORTH>

> Below is an example I put together for Pi Day (yesterday, March 14).
> It computes 1000 digits of Pi.  I know 1000 digits may seem trivial,
> however the target platform is a 1985 battery-power hand-held computer
> with a 20-bit address space.  It takes almost an hour to compute Pi.

The above took no time, compared to the time to printing the result :-)

Look for "Forth Bignum" in Google. First hit was already OK here.

-marcel

2.PI day, and other days of the year.

Michel Olagnon wrote:

> Ian Bush wrote:
>> Hmmm. We can't do PI day, but we can do natural logarithm day !

>  2/7/1828 ?

I find the idea of pi day being 3/14 slightly strange, as it
depends in a complicated way on base 10 counting and the
unusual distribution of days on the calendar.

When I was an undergrad and had a class (AMa95) with especially
hard problem sets due monday morning I would sometimes cook
a pie for eating at pi O'clock, for those still awake and working
on the problems.   I figured pi O'clock as pi hours after midnight,
which does depend on a 24 hour day, but otherwise doesn't depend
on a base 10 representation of either pi or the clock.
(It does depend on the base 12 representation behind the clock, though.)

The time comes out about 3:08:30, not 3:14:15 using the base 10
representation of pi and of hours, minutes, and seconds.

With a similar idea, I might define pi day as the day that includes
the time pi/12 of a year starting from 12:00:00 AM Jan 1st,
and e day is the day including e/12 from the start of the year.

Again the strange dependence on the base 12, but otherwise no
depending on the base of pi, or e, or the base used in counting days.

To find one that is independent of the base of representation, and of
arbitrary representations of the calendar, I suggest imaginary power
day: i**i, oops, (0,1.)**(0,1.) of the way through the year.

365*(0,1.)**(0,1.) is about 75.87604, leaving in the unnatural
counting of leap years vs. non-leap years.  By my count it comes
out March 17th.   On leap years, 366*(0,1.)**(0,1.) also seems
to come out on March 17th, though at a different time.

When I was in high school, before Fortran could evaluate
(0,1.)**(0,1.), and before I knew about the math related
to imaginary powers, I did it in PL/I.   I was, then, very
surprised to see it come out real.

-- glen

3.Documetation and Forth in Aerospace ( Day 30 coding in Forth

m-coughlin wrote:

>     While attending an astrophysics colloquium on gamma ray
> bursts last year, John Doty's name leaped out at me when the
> speaker listed all his collaborators.

Yikes! Sounds dangerous! I'll have to warn folks to keep it on a leash ;-)

> 
>      What use has been made with Forth in the development of
> spacecraft at MIT lately or anywhere else?

Very little in my area. The Chandra SIM has a motor controller 
programmed in Forth, but that didn't help Forth's declining image at 
all. It failed in the first integrated systems test, and it turned out 
that the contractor done no revision or configuration control, so they 
neither knew which version of the code should have been in the ROM, nor 
did they know what was actually in the ROM. Idiots.

I'm developing a test setup for the next generation of x-ray CCD 
detectors here in Colorado: once I deliver it to MIT there will be a few 
users of my LSE64 dialect there (whether they like it or not :-).

> Has any Forth code
> for these systems been published that follows the previously
> recommended good commenting practice? I think code is easier to
> read when the comments and code are interspersed and I would
> like to see a counter example.

Not that I know of.

-jpd

4.team programming (was: Day 30 coding in Forth)

5.Day 31 coding in Forth (getting long)

6. Day 30 coding in Forth

7. Day 30 coding in Forth (getting a bit OT)

8. Gforth version numbering (was: Day 30 coding in Forth)



Return to forth

 

Who is online

Users browsing this forum: No registered users and 37 guest