This is the first post of what will be a very long series about calculating factorials and it is even a long way to the first calculation of a factorial.
available for free and for money, and the author has a lot of that stuff already written. The last argument is the winning one, of course.
Oh, and: yes, this implementation will be with FFT!
All things will get tested in the last stable version of Firefox (currently 15.0.1).
So, to get a good start, we need something to type/paste our lines in, run them, and also something to show the result. A very basic thing is the following:
If the size of the textarea is too small change the numbers in “cols” for the width and “rows” for the height to your delight.
If all works as promised the result should look like this screenshot.
Probably not exactly like that (different fonts, sizes, or whatever) but the structure should be the same: Headline saying “Scratchpad” on top, a field to type something in, two buttons in a row saying “Run It” and “Clear Output”, and a field for the result (collapsed to a black line if it contents
nothing) with the word “Result” printed on top, roughly centered.
So far, so good? Ok, but what if something runs wrong? Well, Firefox has an error-console, to be found under Tools→Web Developer→Error Console (Ctrl+Shift+J). Switch on at least “JS”, “Content” and “Errors”. The error caused by the missing letter T in the function name “PRINT” gives this picture.
Clicking on the field shows up a window with the source and the relevant
As you can see: that is not very helpful here. It is more helpful if the error is in a script-environment or even better an external script.
Here I have put in an obscure error which can happen if the editor has a broken code highlighting or even none at all: a variable has the same name as a reserved identifier:
Clicking on the link in the error-console makes more sense now and gives:
Switching on “Warnings” in the error-console might give a lot of useful hints, too.
The external file named “already_done.js” must be in the same directory as the HTML-file. That external file is the place where we put all the things in, that are complete.
Next: a very basic but working big integer implementation