Flaming Thunder
CD, by Stijn Hertelé
Carved Ellipsoid, by Hassan Sedaghat

13 Sep 2010: Fixed a crash in Windows 7 that was caused by a change in how Microsoft handles stdin and stdout. In case you are a software developer who has seen a similar problem in your own programs, there is more information at Is SetStdHandle(STD_OUTPUT_HANDLE, ..) broken under windows 7 ??

20 Mar 2010: Fixed bug in transferring large files using the CGI POST method.

31 May 2009: Improved memory management, especially in the 64-bit versions.

8 Feb 2009: Fixed two bugs. One sometimes occured when a list was indexed by an expression instead of by a variable, and the other sometimes occured when a local list was used inside of a function.

23 Nov 2008: Flaming Thunder now supports setting and unsetting elements of lists. You can extend a list by setting the next unset element. For example, to initialize a list to the squares of the numbers from 1 to 100:

For i from 1 to 100 do set squares(i) to i^2.

Multidimensional lists work the same way:

For i from 1 to 100 do
  for j from 1 to 100 do
    set squares(i,j) to i^2 + j^2.

4 Jul 2008: Added min and max functions to DPGraph. The functions take two values and return the minimum or maximum value.

28 Jun 2008: Flaming Thunder can now access elements of lists (arrays). Coming soon will be support for setting/unsetting elements of lists. Accessing elements of lists works for both single- and multi-dimensional lists. For example, the program:

Set x to list( list(1,2,3), list(4,5,6), list(7,8,9) ).
Set sum to 0.
For i from 1 to 3 do
  for j from 1 to 3 do
    set sum to sum + x(i,j).
Writeline "The sum is ", sum, ".".

will write:

The sum is 45.

15 Jun 2008: The routine formerly called SetFrameToBlack has been replaced by SetFrameBackgroundRGB, which lets you set a frame's background color to anything you would like. The equivalent to SetFrameToBlack is:

SetFrameBackgroundRGB 0,0,0.

Lists (also known as arrays) are beginning to work. You can create them, and join them, and array elements can appear in symbolic equations, but you can't yet set or access individual elements. Example:

Set x to list( 1, 2, 3 ).
Set y to list( 4, 5, 6 ).
Writeline join( x, y ).
Writeline z(1)^2 + 4*z(2)^2 + z(3).

will write the output:


10 Jun 2008: By popular demand, the routine formerly called Draw3DQuadrangleXYZ4RGB has been renamed to Draw3DQuadrilateralXYZ4RGB.

Fullscreen 3D points and lines are working under Windows. The two new commands are Draw3DPointXYZRGB and Draw3DLineXYZ2RGB. The 3D points are hard to see on high resolution screens. Here is a small program to draw a single green wireframe triangle that you can walk around (Esc to exit; W, A, S, D, or arrow keys to move; mouse to look):

  Draw3DLineXYZ2RGB -3,0,0, 0,0,3, 0,1,0.
  Draw3DLineXYZ2RGB  0,0,3, 3,0,0, 0,1,0.
  Draw3DLineXYZ2RGB -3,0,0, 3,0,0, 0,1,0.
until RequestedToStop.

5 Jun 2008: Fullscreen 3D graphics are working under Windows. The new commands are BeginFullScreen, EndFullScreen, BeginFrame, SetFrameToBlack, EndFrame, DrawFrame, Draw3DTriangleXYZ3RGB, Draw3DQuadrangleXYZ4RGB, and there is a new function RequestedToStop. Here is a small program to draw a single red 3D triangle that you can walk around:

  Draw3DTriangleXYZ3RGB -1,0,0, 1,0,0, 0,0,2, 1,0,0.
until RequestedToStop.
Golden rotating 3D cube on a tiled floor  

The Documention links to more sophisticated examples, such as a golden rotating 3D cube on a tiled floor. Windows users can click here to download or run the compiled program.

The controls in fullscreen 3D mode are:
Esc = exit,
W or up arrow = move forward,
A or left arrow = move left,
S or down arrow = move back,
D or right arrow = move right,
mouse = look left, right, up, or down.

The space you move around in is a right-handed coordinate system. The x and y axes are laying flat on the ground, and the z axis is pointing up. Your eye is at a height of z = 1.5 meters (which is roughly the average human eye height). You start with the x axis running horizontally and the y axis pointing into the screen away from you. You are 8 meters behind the origin where the x and y axes cross (i.e. your starting (x,y) coordinates are (0,-8)), and you are looking toward the origin.

Due to popular demand, we renamed the sine and cosine functions, etc, to their more standard abbreviations, such as sin and cos. Also, we implemented low precision versions of the transcendental functions (such as sin and cos) that we don't yet have high precision versions for, so that people could at least start playing with them using the fullscreen 3D graphics.

28 May 2008: Pi and e are in. The keyword for pi is Pi, and the keyword for e is BaseE. For example:

Writeline pi.
Writeline basee.

Both constants are calculated to whatever the current setting of realdecimaldigits is, so the last few digits will be incorrect due to rounding errors. At some point in the future they will be calculated to slightly more than realdecimaldigits of precision and then rounded to realdecimaldigits.

22 May 2008: FTNotepad now overrides the registry settings for [HKEY_CURRENT_USER\Console] "ColorTable00" through "ColorTable15", and uses the standard Windows default values instead. So now when a program is run, the FTNotepad Run window should always display black text on a white background.

19 May 2008: Added two new variations of the for loop: for forever do and for expression times do. For forever allows you to explicitly create infinite loops, and for expression times allows you to do something a specific number of times without having to declare a looping variable if you don't need one. Examples:

Write "Fa".
For 8 times do write "-la".

For forever do
  Write "Do you know the definition of insanity? ".
  Read response.

19 May 2008: Two new logarithmic functions are in. LogE(x) is the natural logarithm to the base e of x. Log(b,x) is the logarithm base b of x. The calculation of both functions is currently carried out using realdecimaldigits of precision, so the lowest order few digits will be off due to internal rounding errors. We will shortly update both functions so that the calculations are carried out at higher precision and then rounded to realdecimaldigits. For example, the program:

Set realdecimaldigits to 40.
Writeline loge(10).

will write the result:


which is off in the last 2 digits (which should be 60 instead of 54).

14 May 2008: Added the ability to declare local variables in functions, and fixed some problems related to setting global and local variables. Explicitly declaring a variable in a function makes it local. For example, the variable a in the following function is local to the function:

f is a function(x) doing (
  a is a variable.
  set a to 3.
  return a*x.

13 May 2008: Fixed a bug that caused some programs to fail to compile if a function was used before it was defined. Programs such as the following should now compile and run correctly:

WriteLine abs(-10).

Abs  is a function(x) doing return sqrt(sqr(x)).
Sqr  is a function(x) doing return x*x.
Sqrt is a function(x) doing return squareroot(x).

12 May 2008: User-defined functions are in. Flaming Thunder supports recursive functions, nested functions, and functions can be declared after they are used (in case you would like to put your function definitions at the end of your program, glossary style).

The function name is the first word in the function declaration, so that if you put your functions in alphabetical order it is easy to look them up.

Small example showing all of the above:

WriteLine Factorial( 100 ).
WriteLine Distance( 1.0, 1.0, 1.0, 2.0, 2.0, 2.0 ).

Distance is a function(x1,x2,x3,y1,y2,y3) doing
  Return squareroot( square(y1-x1)+square(y2-x2)+square(y3-x3) ).
  Square is a function(w) doing return w*w.
Factorial is a function(n) doing
  if n = 0 then return 1 else return n*factorial(n-1).

29 Apr 2008: High precison square roots are now in. For example, here's how to calculate phi (the golden ratio) to 1000 decimal digits:

Set realdecimaldigits to 1000.
Writeline (1+squareroot(5))/2.

27 Apr 2008: We eliminated the Student version and renamed the Professional version to the Full version. For everyone who purchased a Student subscription, we've upgraded it for free to a Full subscription. For everyone who purchased a Professional subscription, we've extended it for free to a lifetime Full subscription.

23 Apr 2008: There is now a workaround in DPGraph for a bug that a small number of keyboard drivers have, which caused graphs to continue moving after the arrow keys were released.

22 Apr 2008: Added two new functions: ByteCharacter and GetByteValue. ByteCharacter converts an integer from 0 to 255 into a string of length 1. GetByteValue does the opposite; it converts a string of length 1 into an integer from 0 to 255. ByteCharacter is handy for creating strings with non-printable characters in them. For example,

Write "Hello World!",ByteCharacter(13),ByteCharacter(10).
is equivalent to:
Write "Hello World!",CarriageReturn,Linefeed.
which on Windows machines, is equivalent to:
Writeline "Hello World!".
GetByteValue is handy for reading binary values stored in files. For example, if the file input.dat contains a single 2-byte binary number with the lowest-order byte stored first, then the following program shows one way to read the data and write its decimal value:
Read x from "input.dat".
Writeline       GetByteValue(Substring(x,1,1))
          + 256*GetByteValue(Substring(x,2,1)).

13 Apr 2008: Changed the names of the the routines ConvertStringToNumber, ConvertToString and FindString to Number, String and Find. The old names will continue to work in existing code.

9 Apr 2008: You can now set the approximation mode that Flaming Thunder uses for the real arithmetic operations +, -, * and /. The default mode is RoundToEven. Setting the number of real decimal digits also now words for +, -, * and / (see the note for 8 Apr 2008). The 12 real approximation modes are:

RoundAwayFromZero ("schoolbook" rounding)
RoundToEven (probably the best for most applications)

To set the real approximation mode:

Set RealApproximationMode to TruncateTowardZero.

For example, suppose you want to see if 7 decimal digits are enough to sum the harmonic series 1/1 + 1/2 + ... 1/1_000_000. After all, 1_000_000 has only a little more than 6 digits. Let's suppose you also want to see the range of values you can expect under worst case conditions (truncating high and low instead of rounding).

If you run the following program:

Set Sum to 0.0. # Start with defaults: 30 digits, round to even.
For n from 1 to 1_000_000 do set sum to sum + 1.0/n.

Writeline "30 digits, round to even = ", Sum.

Set RealDecimalDigits to 7. # Use 7 digits for the rest.

Set RealApproximationMode to TruncateTowardPositiveInfinity.
Set Sum to 0.0.
For n from 1 to 1_000_000 do set sum to sum + 1.0/n.

Writeline "7 digits, truncate up = ", Sum.

Set RealApproximationMode to RoundToEven.
Set Sum to 0.0.
For n from 1 to 1_000_000 do set sum to sum + 1.0/n.

Writeline "7 digits, round to even = ", Sum.

Set RealApproximationMode to TruncateTowardNegativeInfinity.
Set Sum to 0.0.
For n from 1 to 1_000_000 do set sum to sum + 1.0/n.

Writeline "7 digits, truncate down = ", Sum.

it will write the following output:

30 digits, round to even = 14.3927267228657236313811274295
7 digits, truncate up = 21.61167
7 digits, round to even = 13.05426
7 digits, truncate down = 11.72242

So, you can conclude that 7 digits probably aren't enough. If you change 7 to 10 in the above program and rerun it, it will write:

30 digits, round to even = 14.3927267228657236313811274295
10 digits, truncate up = 14.39768079
10 digits, round to even = 14.39272306
10 digits, truncate down = 14.38779239

So, you can conclude that 10 digits are much better than 7.

8 Apr 2008: You can now set the number of decimal digits to use for real arithmetic. The default number of digits is 30. This only works for division today (so divide by 1.0 at the end of your calculation, for example), but in a day or two will work for the other operations. For example, the program:

Set RealDecimalDigits to 10.
WriteLine 1.0/7.0.
Set RealDecimalDigits to 50.
WriteLine 1.0/49.0.

will write:


6 Apr 2008: Lots of improvements to high precision real arithmetic. Routines that benefited the most are division, maximum, minimum and automatic conversion of integers and rationals where needed. The precision is currently set to about 50 digits for testing. In a day or two the precision will be user-settable, as will the rounding/truncation modes.

For an example, the program:

Set ESum to 0.0.
For n from 0 to 20 do set ESum to ESum + 1/n!.

Set PiSum to 0.0.
For n from 0 to 20 do set PiSum to PiSum + 4*(-1)^n/(2*n+1).

WriteLine "ESum is quickly converging to e:".
WriteLine ESum.
WriteLine "PiSum is slowly converging to pi:".
WriteLine PiSum.

will write:

ESum is quickly converging to e:
PiSum is slowly converging to pi:

Notice how ESum and PiSum are initialized to real 0.0's instead of integer 0's. That forces the conversion of the sums to reals, otherwise Flaming Thunder would evaluate them exactly using arbitrary precision rational arithmetic (see the entry for 30 Mar 2008).

31 Mar 2008: Fixed a bug in error checking. Programs that check for errors (in numeric input, for example) using "is a", "is an", "is not a" or "is not an" will now work correctly:

  Write "Please enter a number: ".
  Read inputstring.
  Set x to ConvertStringToNumber(inputstring).
  If x is an error then
    WriteLine "Invalid number, the error message is: ", x.
    Go to retry.
  WriteLine "Three times your number is ", 3*x.

30 Mar 2008: Lots of improvements to exact arbitrary precision rational arithmetic. For example, here is a program that calculates rational approximations to e and pi by summing the first few terms of two infinite series (the series for e converges much more rapidly than the series for pi):

Set ESum to 0.
For n from 0 to 20 do set ESum to ESum + 1/n!.

Set PiSum to 0.
For n from 0 to 20 do set PiSum to PiSum + 4*(-1)^n/(2*n+1).

Writeline "e is approximately  ",ESum.
Writeline "pi is approximately  ",PiSum.

28 Mar 2008: ConvertStringToNumber(string) now supports real numbers. Numbers can be in ordinary decimal point point format such as 123.4456, or they can be in exponential format such as 112.3E-12.

27 Mar 2008: ConvertToString(parameter) and ConvertStringToNumber(string) are now in. ConvertStringToNumber supports only integers today; real numbers will be working in a day or two.

26 Mar 2008: GetTimeInSeconds() and GetGreenwichMeanTime() now work in Mac OS X 10.4 Tiger. For other developers who may be having similar problems: the Darwin gettimeofday system call number 116 sys_gettimeofday violates BSD calling conventions. It returns seconds in Eax and microseconds in Edx instead of returning them in the timeval structure.

26 Mar 2008: The GetTimeInSeconds() function is in. It returns a real number (for example, 12851007789.703125) which is the time in seconds since Jan 1, 1601. You can measure elapsed time by subtracting the time before a lengthy operation from the time after. The resolution depends on your operating system. There is a bug in Mac OS X 10.4 Tiger (and possibly other versions) which causes GetTimeInSeconds() to return an erroneous time; we are trying to come up with a workaround.

25 Mar 2008: Under FreeBSD, Linux and Mac OS X, changed the default permissions on files created by the Write To and WriteLine To procedures from 600 (readable/writeable only by the owner) to 644 (also readable by anyone else). This facilitates writing HTML pages on a server that are automatically readable on the web.

25 Mar 2008: As per the specifications, the CGI and environment variable functions are now only available in the Professional Edition.

24 Mar 2008: Created a Google Groups discussion forum for Flaming Thunder. Click on the Forum link in the menu.

24 Mar 2008: Fixed a rarely occuring bug in the Quotient, Remainder, Mod, LeastCommonMultiple and GreatestCommonDivisor functions that caused incorrect results for certain remainders.

22 Mar 2008: Easy file i/o is in. The statements are Remove, Read From, Write To, and WriteLine To. For example, a short program to create a new file and then copy two other files into it, is:

Remove "output.txt".
Read x from "input1.txt".
Read y from "input2.txt".
Write x,y to "output.txt".

Write To appends the data to the file, so another way to write the same program is:

Remove "output.txt".
Read x from "input1.txt".
Write x to "output.txt".
Read x from "input2.txt".
Write x to "output.txt".

WriteLine To works in the same way as Write To, except that it appends a newline to the end of each piece of data that it writes:

Remove "output.txt".
Writeline "This is the 1st line" to "output.txt".
Writeline "This is the 2nd line" to "output.txt".

20 Mar 2008: Fixed a problem in FTNotepad that sometimes caused the error "InitDialog_SetFocus 00000006" under Windows XP SP2.

19 Mar 2008: New functions: FindString, Substring and GetStringLength.

17 Mar 2008: New functions: LowercaseASCII and GetGreenwichMeanTime.

15 Mar 2008: Flaming Thunder now sets the owner-executable bit even if a previously existing file with the same name had the executable bit turned off.

15 Mar 2008: Flaming Thunder now sets the owner-executable bit on executable files created under FreeBSD, Linux and Mac OS X, if the file can be executed on the operating system that it was compiled under. For example, Flaming Thunder will not set the owner-executable bit on a FreeBSD program cross-compiled under Linux because Linux cannot execute it.

15 Mar 2008: Fixed a bug in FreeBSD executables.

14 Mar 2008: Happy Pi Day (3/14)!

Added routines to support easy CGI scripting: GetUndecodedCGIData, GetUndecodedCGIDataSize, GetDecodedCGIVariableCount, GetDecodedCGIVariableName, GetDecodedCGIVariableIndex, GetDecodedCGIVariableValue, GetDecodedCGIVariableFileCount, GetDecodedCGIVariableFileName and GetDecodedCGIVariableFileData.

GetUndecodedCGIDataSize allows you to check the size of the raw CGI data before processing any of it, so that, for example, you can reject unexpectedly large file transfers with the least amount of overhead.

GetUndecodedCGIData allows you to view the raw undecoded CGI data, which might be handy if a particular browser and/or server is causing the decode routines to fail. If that is the case, you should alert us so that we can update the decoding routines. So far we have tested the routines with the current versions of Internet Explorer, FireFox and Safari.

GetDecodedCGIVariableCount, GetDecodedCGIVariableName, GetDecodedCGIVariableIndex and GetDecodedCGIVariableValue allow you to process ordinary CGI variables.

GetDecodedCGIVariableFileCount, GetDecodedCGIVariableFileName and GetDecodedCGIVariableFileData allow you process type=file CGI variables.

5 Mar 2008: Fixed a bug in the 64-bit versions in adding floating point numbers that had certain negative differences between their exponents. Also, fixed a problem running the Professional Edition of FTNotepad on 32-bit systems.

3 Mar 2008: Added the Seive of Eratosthenes to the examples. Added some new functions: AbsoluteValue, GreatestCommonDivisor, LeastCommonMultiple, Quotient, Remainder, UppercaseASCII. Added two new operators: mod and divides. Mod and divides allow you write statements such as If x mod 7 = 5 then ... and If x divides y then ....

21 Feb 2008: Added examples to the documentation showing how to create several kinds of CGI scripts.

19 Feb 2008: Made an improvement in memory allocation under 64-bit Linux.

18 Feb 2008: Made an improvement in memory allocation under FreeBSD and Mac OS X.

16 Feb 2008: We released FTNotepad today – an easy-to-use version of Flaming Thunder for Windows users that you can run directly from the internet. We also added interval arithmetic so that you can let Flaming Thunder propagate imprecision in your inputs through a calculation and tell you how imprecise your results are.

13 Dec 2007: Large numbers (greater than about 5,000 digits for 32-bit versions and 10,000 digits for 64-bit versions) are now multiplied using an O(N log(N)) number theoretic transform. If you have enough memory, Flaming Thunder's triple-prime algorithm supports numbers of over 3 quintillion decimal digits. RAM manufacturers around the world are celebrating.

4 Dec 2007: First public Flaming Thunder release.

Free version
Full version
List of site
13 Sep 2010
Graph credits: carved ellipsoid by Hassan Sedaghat, CD by Stijn Hertelé.
©2002-2010 Flaming Thunder