Calculator Array Version 1.0 By Mark Kuzmycz ABOUT Calculator Array is a simple floating point calculator. This calculator comes with not only 1 calculator but two so that you can keep several results visable when programming or writting reports. How can you view the results of the calculator as you are working if the application has it's own screen? I'm glad you asked! Well, this calculator(s) has the ability to attach itself to any screen. Yes, any screen. Not only can it do this but it is also semi programmable but more about this later. DISTRIBUTION This tool is Public Domain. Feel free to distribute it around. If you wish to donate me some money (any amount) to help me upgrade my system (I currently have an Amiga 500 with 1 Meg of memory and workbench 1.3) then feel free to do so. My address is bellow. REMEMBER: I have copyright therefor I will not allow anyone to sell this tool for more than a price of a disk. GUIDE The rest of this manual discusses the use of the calulators features. Fear not, however, as every option will be correct as I will test each example as I go. Actually I have the calculator in front of me now and I suggest that you do the same. CALCULATOR MENU Current screen. This option waits for a few seconds (10) allowing you to bring the required screen to the front then it brings the calculator to that screen. Try it now by hitting the menu item or the keyboard shortcut RAmiga-C then brind forward the workbench screen. Select Screen. This menu option does a similar job to Current Screen except that it brings up a window with a list of screens to choose from. Select the screen you wish. If the screen you entered does not exist then the operation will fail. REFRESH Unfortunately while entering this document I've discovered that the text editor that Blitz Basic tends to destroy the calulators window. This is probably due to blitz not using intuition routines. (Bummer). This option will refresh the windo for you. BANKS MENU Each evaluate menu item corresponds to a calculator position in the array. For example the first execute belongs to the first (top) calculator. While the fifth belongs to the fith calculator. The evaluator menu switches off evaluation of the calculator. Why would you want to do that? Well, it makes it poosible to use the bank as a template or a function. The only thing needed is a way for one bank (calculator) to access another. In fact, there is a way ! It is called the Bank command. BankN Command BankN is a five character command where N is a number from 1 to 9. Note the number must be adjacent to the word bank or else the command will fail to work. E.g. Bank1 * 5 will evaluate the contents of bank1 and multiply the result by five. Example 1. For this example I will program the calculator to work out the percentage of number. The first bank (bank1) will contain the value that we want to find the percentage of while the sencond bank (bank2) will contain the percentage. Bank3 will contain the equation. Finally, bank4 will execute everything. bank1 <--- 599 bank2 <--- 10 Switch off evaluation of bank3 bank3 <--- BanK1 *bANk2/100 bank4 <--- bank3 Once you have hit return on bank3 the result 59.9 (10% of 559) will be displayed in bank4. EXAMPLE2 This example converts degrees to radians the finds the sine of the value storing it in bank 4. disable banks 2 and 3 bank1 <- 30 Angle bank2 <- bank1*Pi/180 Converts angle to radians bank3 <- Sin(bank2) Find the sine of an angle bank4 <- bank3 Store the result here result will be aproximately 0.5 (0.4999999 to be exact). Why isn't it 0.5 well it's due pi not being exact enough (the value is .00000006 out). ERRORS In the event of there being an error then the word Error will be displayed in the appropriate bank. The possible causes of errors are: Bad syntax recursive bank calls (causes infinite looping) Too complex an expression (Let me know if this ever happens) Unknown bank (if you leave out the bank number or have a space in between) division by zero log of a zero or negative number Operators Available ******************* () + - * / sin() : argument is in radians cos() : argument is in radians tan() : argument is in radians arsin() arcos() artan() sinh() cosh() tanh() ln() : Natural log log() : log to the base 10 Constants. ********** Currently only one. Pi Next Release ************ The following are being considered if there IS ENOUGH interest. saving of calculator to a file linking a bank to the evaluationof a bank and all banks evaluated when one is evaluated so that when the value in bank1 of the example is changed the result in bank 4 automatically changes to the result of bank3 (assuming bank 4 is linked) to bank3) Note if there is interest I can get out the new release in a couble of days (Yes it is that easy to upgrade.) WARNING do not destroy the screen that the calculator resides on. If you do the calculator will be lost! BUGS Blitz Basic doesn't pick up errors properly for tan and log. I've managed to detect the errors myself for log but tan is harder i.e. error at (n*pi+1)/2 where n ranges from zero to infinity. Comments This work is a part of a tutorial on how to use various aspect of blitz and is basically a spinoff from something that I'm working on. PS. Fan mail would be nice! <:^> Next Project Due Expert System Date August (It may be sooner!!!!) Author Mark Kuzmycz 3 Gaunt Street Lara Victoria Australia 3212 EMAIL kuzmycz@deakin.edu.au