rounded.log 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
  2. Dump file created: Mon May 23 10:39:11 1994
  3. REDUCE 3.5, 15-Oct-93 ...
  4. Memory allocation: 6023424 bytes
  5. +++ About to read file ndotest.red
  6. % Tests in the exact mode.
  7. x := 1/2;
  8. 1
  9. x := ---
  10. 2
  11. y := x + 0.7;
  12. 6
  13. y := ---
  14. 5
  15. % Tests in approximate mode.
  16. on rounded;
  17. y;
  18. 1.2
  19. % as expected not converted to approximate form.
  20. z := y+1.2;
  21. z := 2.4
  22. z/3;
  23. 0.8
  24. % Let's raise this to a high power.
  25. ws^24;
  26. 0.00472236648287
  27. % Now a high exponent value.
  28. % 10.2^821;
  29. % Elementary function evaluation.
  30. cos(pi);
  31. - 1
  32. symbolic ws;
  33. (!*sq ((!:rd!: . -1.0) . 1) t)
  34. z := sin(pi);
  35. z := 1.22464679915e-16
  36. symbolic ws;
  37. (!*sq ((!:rd!: . 1.2246467991474e-16) . 1) t)
  38. % Handling very small quantities.
  39. % With normal defaults, underflows are converted to 0.
  40. exp(-100000.1**2);
  41. 0
  42. % However, if you really want that small number, roundbf can be used.
  43. on roundbf;
  44. exp(-100000.1**2);
  45. 1.18441281937e-4342953505
  46. off roundbf;
  47. % Now let us evaluate pi.
  48. pi;
  49. 3.14159265359
  50. % Let us try a higher precision.
  51. precision 50;
  52. 12
  53. pi;
  54. 3.1415926535897932384626433832795028841971693993751
  55. % Now find the cosine of pi/6.
  56. cos(ws/6);
  57. 0.86602540378443864676372317075293618347140262690519
  58. % This should be the sqrt(3)/2.
  59. ws**2;
  60. 0.75
  61. %Here are some well known examples which show the power of this system.
  62. precision 10;
  63. 50
  64. % This should give the usual default again.
  65. let xx=e**(pi*sqrt(163));
  66. let yy=1-2*cos((6*log(2)+log(10005))/sqrt(163));
  67. % First notice that xx looks like an integer.
  68. xx;
  69. 2.625374126e+17
  70. % and that yy looks like zero.
  71. yy;
  72. 0
  73. % but of course it's an illusion.
  74. precision 50;
  75. 10
  76. xx;
  77. 2.6253741264076874399999999999925007259719818568888e+17
  78. yy;
  79. - 1.2815256559456092775159749532170513334408547400481e-16
  80. %now let's look at an unusual way of finding an old friend;
  81. precision 50;
  82. 50
  83. procedure agm;
  84. <<a := 1$ b := 1/sqrt 2$ u:= 1/4$ x := 1$ pn := 4$ repeat
  85. <<p := pn;
  86. y := a; a := (a+b)/2; b := sqrt(y*b); % Arith-geom mean.
  87. u := u-x*(a-y)**2; x := 2*x; pn := a**2/u;
  88. write "pn=",pn>> until pn>=p; p>>;
  89. agm
  90. let ag=agm();
  91. ag;
  92. pn=3.1876726427121086272019299705253692326510535718594
  93. pn=3.1416802932976532939180704245600093827957194388154
  94. pn=3.1415926538954464960029147588180434861088792372613
  95. pn=3.1415926535897932384663606027066313217577024113424
  96. pn=3.1415926535897932384626433832795028841971699491647
  97. pn=3.1415926535897932384626433832795028841971693993751
  98. pn=3.1415926535897932384626433832795028841971693993751
  99. 3.1415926535897932384626433832795028841971693993751
  100. % The limit is obviously.
  101. pi;
  102. 3.1415926535897932384626433832795028841971693993751
  103. end;
  104. (TIME: rounded 683 683)
  105. End of Lisp run after 0.71+0.63 seconds