@@ -1,256 +1,256 @@ -REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ... - - -% Tests in the exact mode. - -x := 1/2; - - - 1 -x := --- - 2 - - -y := x + 0.7; - - - 6 -y := --- - 5 - - -% Tests in approximate mode. - -on rounded; - - - -y; - - -1.2 - % as expected not converted to approximate form. - -z := y+1.2; - - -z := 2.4 - - -z/3; - - -0.8 - - -% Let's raise this to a high power. - -ws^24; - - -0.00472236648287 - - -% Now a high exponent value. - -% 10.2^821; - -% Elementary function evaluation. - -cos(pi); - - - - 1 - - -symbolic ws; - - -(!*sq ((!:rd!: . -1.0) . 1) t) - - -z := sin(pi); - - -z := 1.22460635382e-16 - - -symbolic ws; - - -(!*sq ((!:rd!: . 1.2246063538224e-016) . 1) t) - - -% Handling very small quantities. - -% With normal defaults, underflows are converted to 0. - -exp(-100000.1**2); - - -0 - - -% However, if you really want that small number, roundbf can be used. - -on roundbf; - - - -exp(-100000.1**2); - - -1.18441281937e-4342953505 - - -off roundbf; - - - -% Now let us evaluate pi. - -pi; - - -3.14159265359 - - - -% Let us try a higher precision. - -precision 50; - - -12 - - -pi; - - -3.1415926535897932384626433832795028841971693993751 - - -% Now find the cosine of pi/6. - -cos(ws/6); - - -0.86602540378443864676372317075293618347140262690519 - - -% This should be the sqrt(3)/2. - -ws**2; - - -0.75 - - - -%Here are some well known examples which show the power of this system. - -precision 10; - - -50 - - -% This should give the usual default again. - -let xx=e**(pi*sqrt(163)); - - - -let yy=1-2*cos((6*log(2)+log(10005))/sqrt(163)); - - - -% First notice that xx looks like an integer. - -xx; - - -2.625374126e+17 - - -% and that yy looks like zero. - -yy; - - -0 - - -% but of course it's an illusion. - -precision 50; - - -10 - - -xx; - - -2.6253741264076874399999999999925007259719818568888e+17 - - -yy; - - - - 1.2815256559456092775159749532170513334408547400481e-16 - - -%now let's look at an unusual way of finding an old friend; - -precision 50; - - -50 - - -procedure agm; - <