Forth MP Code? Pi Day.



  • 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.


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 ;}

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.

[1]FORTH> .s
  Data: 393 ---
System: ---
 Float: --- ok

> 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.


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 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