Computer Whizz's Mathematical Library 0.8

paul_one
02 Dec 2004, 19:56
Right, it hasn't reached version 1.0 yet, mainly because there's 2 functions to add... the $CML_round(n1)$ function, and the rest of the $CML_decimal( P/S/M;n1;n2 [;nx;nx+1...] )$ function.

But I am releasing this to the public to make sure there aren't any bugs that I've missed so far.

There's the decimal function: $CML_decimal( D;n1;n2 )$ which returns a decimal string of a number devided by another number.
We also have these functions:
$CML_add(n1;n2[;nx;nx+1...])$ (adds numbers together... for example: set numeric <result; $CML_add(1;2;3;4;5)$ > ... Result = 15 )
$CML_sub(n1;n2 [;nx;nx+1...])$ (subtracts subsequent numbers from the first... EG. set numeric <result; $CML_sub(30;1;2;3;4)$ > ... Result = 20 )
$CML_mult(n1;n2 [;nx;nx+1...])$ (multiplies numbers together... EG. set numeric <result; $CML_mult(1;2;3;4;5)$ >... Result = 120 )
$CML_div(n1;n2)$ (devides n1 by n2... ONLY n1 and n2!)

Hope people can use this, and also suggest other functions for maths.
I have done this mainly because I don't like only two calculation in quest right now... So now you can do this:
set numeric <$CML_add(3;5;2)$ * $CML_div(50;2)$ >
which is 3 different actions, but also 5 seperate set's in one.

Once again, suggestions are welcome here.
I'm thinking about the following myself right now:
$CML_equ(#function#;n1;n2 [;nx [functionx;[functiony];m1;mx]])$ so you could in fact have this:
$CML_equ(P;3;5;2;M;D;50;2)$ to do the stuff above in one call... also:
$CML_equ(P;1;2;M;3;P;S;50;25)$ would result is (3*3)+(50-25) = 31
I shall have to think it over some though... Your thoughts are welcome (again)...

::EDIT::
Forgot the link:
http://www.compwhizz.freeserve.co.uk/cmathlib.zip

paul_one
03 Dec 2004, 18:07
OK, the file has been changed to V 0.8 . I will probably never update it again since the limitation of the signed INT's Quest uses (which is about 35,000 or 2^15)... It limits my decimal stuff, so only 175 + 175 is possible with addition (because it turns it into 17,500 + 17,500) and also subtraction.

In fact, although THAT looks OK (I mean - people adding loads of numbers up to 350?) if you look at multiplication - it is limited to 1.75 * 1.75 or probably less... In fact, it can only calculate two numbers multiplied to result in 3.5 (since 100*100=1*1... meaning 35,000=3.5).

I should have realised this in the start, so unless a major overhaul is done (seperating the decimals completely) which I don't even want to think about right now, decimals aren't capable right now.

... That is all...

007bond
03 Dec 2004, 22:33
at least someone was willing to have a go.

paul_one
22 Feb 2005, 00:18
OK, so this is just to bring this to everyone's attention really...
Version is now 0.9a, a=alpha. If I get no bug reports then it's going to 1.0 in about a week or so.
I can't think about how to break it, but I've put as many checks in there as I can possibly imagine.
Check out the quest log feature if you try to make it go wrong - as I have it make a debug notice if anything goes wrong, and it also returns ERROR if something went badly wrong.

The new library is here:
http://www.compwhizz.freeserve.co.uk/as ... ML.09a.zip

This zip file contains 3 files:
CML.qlb ... This is the library which holds the functions.
CML_versions.txt ... This file just shows how the library progressed through the previous versions, and also a tiny bit of usage info.
CML_test.asl ... This file gives a little demo of the four procedures which should be used from the library.

I'll be updating the CML_test.asl file soon, but that is all, so please. Download and try to find as many bugs as you can!