| 1 |
\errorcontextlines999\relax |
| 2 |
%\def\MFPextra{} |
| 3 |
%X\input minifp.sty\relax X |
| 4 |
%X\MFPloadextra X |
| 5 |
X\input mfpextra\relax X |
| 6 |
X\input mfpextra\relax X |
| 7 |
|
| 8 |
|
| 9 |
\def\filbreak{\vskip 12pt plus 100pt\penalty 0 \vskip 0pt plus -100pt\relax} |
| 10 |
\def\meaningless#1>{} |
| 11 |
\def\verbprint#1{% |
| 12 |
\begingroup |
| 13 |
\toks0=\expandafter{#1}\edef\x{\the\toks0}% |
| 14 |
\edef\x{\expandafter\meaningless\meaning\x}% |
| 15 |
\tt "\x"% |
| 16 |
\endgroup} |
| 17 |
{\catcode`\@=11 |
| 18 |
\gdef\y{\Y\\} |
| 19 |
\gdef\Y{\space\verbprint\MFP@Rstack}% adds its own space |
| 20 |
} |
| 21 |
\def\\{\hfill\break\ignorespaces} |
| 22 |
\def\U{\X} |
| 23 |
\baselineskip 12.1pt plus .2pt minus 2pt |
| 24 |
|
| 25 |
\filbreak |
| 26 |
\startMFPprogram |
| 27 |
{\bf Stack-only operations:}\\ |
| 28 |
Stack is empty, test the error message for popping an empty |
| 29 |
stack:\immediate\write16{^^J*** The following tests the error for popping an |
| 30 |
empty stack:^^J}\Rpop\X\y |
| 31 |
Push 0.000 001:\Rpush{0.000 001}\y |
| 32 |
Pop into {\tt\string\X}:\Rpop\X\\ |
| 33 |
\indent {\tt \string\X:}\verbprint\X\\ |
| 34 |
\indent {\tt stack:}\y |
| 35 |
Push 1.2 then -2.3:\Rpush{1.2}\Rpush{-2.3}\y |
| 36 |
Exchange them:\Rexch\y |
| 37 |
Duplicate the last:\Rdup\Y |
| 38 |
|
| 39 |
\filbreak |
| 40 |
{\bf Unary operations:}\\ |
| 41 |
First a new stack with only one value |
| 42 |
$21.34$:\Rpop\X\Rpop\X\Rpop\X\Rpush{21.34}\y |
| 43 |
Unless otherwise noted, the stack will always be restored to this value |
| 44 |
between operations. |
| 45 |
|
| 46 |
\medskip |
| 47 |
\noindent |
| 48 |
Change sign:\Rchs\y |
| 49 |
\Rpop\X\Rpush{21.34}% |
| 50 |
Absolute value:\Rabs\y |
| 51 |
\Rpop\X\Rpush{21.34}% |
| 52 |
Integer part:\Rint\y |
| 53 |
\Rpop\X\Rpush{21.34}% |
| 54 |
Fractional part:\Rfrac\y |
| 55 |
\Rpop\X\Rpush{21.34}% |
| 56 |
Double:\Rdbl\y |
| 57 |
\Rpop\X\Rpush{21.34}% |
| 58 |
Halve:\Rhalve\y |
| 59 |
\Rpop\X\Rpush{21.34}% |
| 60 |
Signum:\Rsgn\y |
| 61 |
\Rpop\X\Rpush{-21.34}% |
| 62 |
Signum of negative:\Rsgn\y |
| 63 |
\Rpop\X\Rpush{21.34}% |
| 64 |
Increment:\Rincr\y |
| 65 |
\Rpop\X\Rpush{21.34}% |
| 66 |
Decrement:\Rdecr\y |
| 67 |
\Rpop\X\Rpush{21.34}% |
| 68 |
Sine:\Rsin\y |
| 69 |
\Rpop\X\Rpush{21.34}% |
| 70 |
Cosine:\Rcos\y |
| 71 |
\Rpop\X\Rpush{21.34}% |
| 72 |
Radians to degrees:\Rdeg\y |
| 73 |
\Rpop\X\Rpush{-21.34}% |
| 74 |
Degrees to radians (negative):\Rrad\y |
| 75 |
\Rpop\X\Rpush{21.34}% |
| 76 |
Common logarithm:\Rlog\y |
| 77 |
\Rpop\X\Rpush{21.34}% |
| 78 |
Natural logarithm:\Rln\y |
| 79 |
Put $-1.34$ on the stack:\Rpop\X\Rpush{-1.34}\y |
| 80 |
Exponential:\Rexp\y |
| 81 |
Put $3.3$ on the stack:\Rpop\X\Rpush{3.3}\y |
| 82 |
Exponential:\Rexp\y |
| 83 |
Back to $21.34$:\Rpop\X\Rpush{21.34}\y |
| 84 |
Square:\Rsq\y |
| 85 |
\Rpop\X\Rpush{21.34}% |
| 86 |
Inversion:\Rinv\y |
| 87 |
\Rpop\X\Rpush{21.34}% |
| 88 |
Floor:\Rfloor\y |
| 89 |
\Rpop\X\Rpush{21.34}% |
| 90 |
Ceiling:\Rceil\y |
| 91 |
\Rpop\X\Rpush{21.34}% |
| 92 |
Square root:\Rsqrt\y |
| 93 |
\Rpop\X\Rpush{21.34}% |
| 94 |
Random number:\Rrand\y |
| 95 |
\Rpop\X\Rpush{21.34}% |
| 96 |
% restart with second generator |
| 97 |
\MFPsetseed0 |
| 98 |
\MFPrandgenB |
| 99 |
Another:\Rrand\y |
| 100 |
\Rpop\X\Rpush{21.34}% |
| 101 |
% restart with third generator |
| 102 |
\MFPsetseed0 |
| 103 |
\MFPrandgenC |
| 104 |
Another:\Rrand\y |
| 105 |
Now push $21.34$ and $12.34$ in that order:\Rpop\X\Rpush{21.34}\Rpush{12.34}\y |
| 106 |
Compare: \Rcmp |
| 107 |
21.34 is\IFlt{}{ not} less than 12.34. |
| 108 |
21.34 is\IFgt{}{ not} more than 12.34. |
| 109 |
21.34 is\IFeq{}{ not} equal to 12.34.\\ |
| 110 |
Take difference and check:\Rsub\Rchk\y |
| 111 |
21.34-12.34 is\IFneg {}{ not} negative. |
| 112 |
21.34-12.34 is\IFpos {}{ not} positive. |
| 113 |
21.34-12.34 is\IFzero{}{ not} zero. |
| 114 |
|
| 115 |
\Rpop\X |
| 116 |
|
| 117 |
\filbreak |
| 118 |
{\bf Binary operations:}\\ |
| 119 |
({\it After each operation we restore the original stack.})\\ |
| 120 |
Start with empty stack and\\ |
| 121 |
push 1.2 then -2.3:\Rpush{1.2}\Rpush{-2.3}\y |
| 122 |
Angle:\Rangle\y\Rpop\X\Rpush{1.2}\Rpush{-2.3}% |
| 123 |
Add:\Radd\y\Rpop\X\Rpush{1.2}\Rpush{-2.3}% |
| 124 |
Subtract:\Rsub\y\Rpop\X\Rpush{1.2}\Rpush{-2.3}% |
| 125 |
Multiply:\Rmul\y\Rpop\X\Rpush{1.2}\Rpush{-2.3}% |
| 126 |
Divide:\Rdiv\y |
| 127 |
New stack:\Rpop\X\Rpush{2.3}\Rpush{0}\y |
| 128 |
\immediate\write16{^^J*** The following tests the error for dividing by 0:^^J} |
| 129 |
Divide by zero:\Rdiv\y |
| 130 |
Reset stack:\Rpop\X\Rpush{2.3}\Rpush{17}\y |
| 131 |
Raise to a power ($(2.3)^{17}$):\Rpow\y |
| 132 |
Reset stack:\Rpop\X\Rpush{2.3}\Rpush{-17}\y |
| 133 |
Raise to a power ($(2.3)^{-17}$):\Rpow\y |
| 134 |
Back to $1.2$ and $-2.3$:\Rpop\X\Rpush{1.2}\Rpush{-2.3}\y |
| 135 |
Find max:\Rmax\y |
| 136 |
\Rpop\X\Rpush{1.2}\Rpush{-2.3}% |
| 137 |
Find min:\Rmin\y |
| 138 |
Exporting stack (value above).\\ |
| 139 |
Exporting \verbprint\U: \verbprint\X |
| 140 |
\ExportStack |
| 141 |
\Export\X |
| 142 |
% change \X |
| 143 |
\def\X{0} |
| 144 |
\stopMFPprogram |
| 145 |
|
| 146 |
\medskip |
| 147 |
\noindent |
| 148 |
Exported value of \verbprint\U: \verbprint\X\\ |
| 149 |
Exported value of stack:\Y |
| 150 |
|
| 151 |
\def\w{\W\\} |
| 152 |
\def\W{ \verbprint\Z}% adds its own space |
| 153 |
|
| 154 |
\filbreak |
| 155 |
{\bf Operand forms}\\ |
| 156 |
{\it All results go to {\tt\string\Z}. All operate on {\tt\string\X} |
| 157 |
and/or {\tt\string\Y}}\\ |
| 158 |
Define ${\tt X}=1.2$ and ${\tt Y}=-2.3$:\def\X{1.2}\def\Y{-2.3}\\ |
| 159 |
\indent {\tt X}:=\verbprint\X\\ |
| 160 |
\indent {\tt Y}:=\verbprint\Y |
| 161 |
|
| 162 |
\filbreak |
| 163 |
{\bf Unary operations:}\\ |
| 164 |
Change sign of {\tt X}:\MFPchs\X\Z\w |
| 165 |
Change sign of {\tt Y}:\MFPchs\Y\Z\w |
| 166 |
Absolute value of {\tt X}:\MFPabs\X\Z\w |
| 167 |
Absolute value of {\tt Y}:\MFPabs\Y\Z\w |
| 168 |
Double value of {\tt X}:\MFPdbl\X\Z\w |
| 169 |
Double value of {\tt Y}:\MFPdbl\Y\Z\w |
| 170 |
Half of {\tt X}:\MFPhalve\X\Z\w |
| 171 |
Half of {\tt Y}:\MFPhalve\Y\Z\w |
| 172 |
Integer part of {\tt X}:\MFPint\X\Z\w |
| 173 |
Integer part of {\tt Y}:\MFPint\Y\Z\w |
| 174 |
Signum of {\tt X}:\MFPsgn\X\Z\w |
| 175 |
Signum of {\tt Y}:\MFPsgn\Y\Z\w |
| 176 |
Increment of {\tt X}:\MFPincr\X\Z\w |
| 177 |
Increment of {\tt Y}:\MFPincr\Y\Z\w |
| 178 |
Decrement of {\tt X}:\MFPdecr\X\Z\w |
| 179 |
Decrement of {\tt Y}:\MFPdecr\Y\Z\w |
| 180 |
Square of {\tt X}:\MFPsq\X\Z\w |
| 181 |
Square of {\tt Y}:\MFPsq\Y\Z\w |
| 182 |
Inverse of {\tt X}:\MFPinv\X\Z\w |
| 183 |
Inverse of {\tt Y}:\MFPinv\Y\Z\w |
| 184 |
Fractional part of {\tt X}:\MFPfrac\X\Z\w |
| 185 |
Fractional part of {\tt Y}:\MFPfrac\Y\Z\w |
| 186 |
Floor of {\tt X}:\MFPfloor\X\Z\w |
| 187 |
Floor of {\tt Y}:\MFPfloor\Y\Z\w |
| 188 |
Ceiling of {\tt X}:\MFPceil\X\Z\w |
| 189 |
Ceiling of {\tt Y}:\MFPceil\Y\Z\w |
| 190 |
Sine of {\tt 30}:\MFPsin{30}\Z\w |
| 191 |
Sine of {\tt 420}:\MFPsin{420}\Z\w |
| 192 |
Cosine of {\tt 60}:\MFPcos{60}\Z\w |
| 193 |
Cosine of {\tt 390}:\MFPcos{390}\Z\w |
| 194 |
Common logarithm of {\tt X}:\MFPlog\X\Z\w |
| 195 |
\immediate\write16{^^J*** The following tests the warning for log of a negative |
| 196 |
number:^^J}% |
| 197 |
Common logarithm of {\tt Y}:\MFPlog\Y\Z\w |
| 198 |
Natural logarithm of {\tt X}:\MFPln\X\Z\w |
| 199 |
\immediate\write16{^^J*** The following tests the warning for ln of a negative |
| 200 |
number:^^J}% |
| 201 |
Natural Logarithm of {\tt Y}:\MFPln\Y\Z\w |
| 202 |
Exponential of {\tt X}:\MFPexp\X\Z\w |
| 203 |
Exponential of {\tt Y}:\MFPexp\Y\Z\w |
| 204 |
Square root of {\tt X}:\MFPsqrt\X\Z\w |
| 205 |
Square root of {\tt Y}:\MFPsqrt\Y\Z\w |
| 206 |
\MFPrandgenA |
| 207 |
Random number less than {\tt X}:\MFPrand\X\Z\w |
| 208 |
Random number less than {\tt Y}:\MFPrand\Y\Z\w |
| 209 |
\MFPsetseed0 |
| 210 |
\MFPrandgenB |
| 211 |
Another less than {\tt X}:\MFPrand\X\Z\w |
| 212 |
Another less than {\tt Y}:\MFPrand\Y\Z\w |
| 213 |
\MFPsetseed0 |
| 214 |
\MFPrandgenC |
| 215 |
Another less than {\tt X}:\MFPrand\X\Z\w |
| 216 |
Another less than {\tt Y}:\MFPrand\Y\Z\w |
| 217 |
|
| 218 |
\filbreak |
| 219 |
{\bf Extra tests of sine}\\ |
| 220 |
Sine of 1:\MFPsin{1}\Z\w |
| 221 |
Cosine of 1:\MFPcos{1}\Z\w |
| 222 |
Sine of $-2$:\MFPsin{-2}\Z\w |
| 223 |
Cosine of 3:\MFPcos{3}\Z\w |
| 224 |
Sine of $-4$:\MFPsin{-4}\Z\w |
| 225 |
Cosine of 5:\MFPcos{5}\Z\w |
| 226 |
Sine of $-6$:\MFPsin{-6}\Z\w |
| 227 |
Cosine of 7:\MFPcos{7}\Z\w |
| 228 |
Sine of $-8$:\MFPsin{-8}\Z\w |
| 229 |
Cosine of 9:\MFPcos{9}\Z\w |
| 230 |
Sine of $-10$:\MFPsin{-10}\Z\w |
| 231 |
Cosine of 20:\MFPcos{20}\Z\w |
| 232 |
Sine of $-30$:\MFPsin{-30}\Z\w |
| 233 |
Cosine of 40:\MFPcos{40}\Z\w |
| 234 |
Sine of $-50$:\MFPsin{-50}\Z\w |
| 235 |
Cosine of 60:\MFPcos{60}\Z\w |
| 236 |
Sine of $-70$:\MFPsin{-70}\Z\w |
| 237 |
Cosine of 80:\MFPcos{80}\Z\w |
| 238 |
Sine of $-90$:\MFPsin{-90}\Z\w |
| 239 |
Sine of $135$:\MFPsin{135}\Z\w |
| 240 |
Sine of $180$:\MFPsin{180}\Z\w |
| 241 |
Sine of $225$:\MFPsin{225}\Z\w |
| 242 |
Sine of $270$:\MFPsin{270}\Z\w |
| 243 |
Sine of $315$:\MFPsin{315}\Z\W |
| 244 |
|
| 245 |
\medskip |
| 246 |
\noindent |
| 247 |
Angle of $(10,.1)$:\MFPangle{10}{.1}\Z\w |
| 248 |
Angle of $(-11.5,.1)$:\MFPangle{-11.5}{.1}\Z\w |
| 249 |
Angle of $(11.5,-.2)$:\MFPangle{11.5}{-.2}\Z\w |
| 250 |
Angle of $(-11.5,.3)$:\MFPangle{-11.5}{.3}\Z\w |
| 251 |
Angle of $(11.5,-.4)$:\MFPangle{11.5}{-.4}\Z\w |
| 252 |
Angle of $(-11.5,.5)$:\MFPangle{-11.5}{.5}\Z\w |
| 253 |
Angle of $(11.5,-.6)$:\MFPangle{11.5}{-.6}\Z\w |
| 254 |
Angle of $(-11.5,.7)$:\MFPangle{-11.5}{.7}\Z\w |
| 255 |
Angle of $(11.5,-.8)$:\MFPangle{11.5}{-.8}\Z\w |
| 256 |
Angle of $(-11.5,.9)$:\MFPangle{-11.5}{.9}\Z\w |
| 257 |
Angle of $(11.5,-1)$:\MFPangle{11.5}{-1}\Z\w |
| 258 |
Angle of $(-11.5,2)$:\MFPangle{-11.5}{2}\Z\w |
| 259 |
Angle of $(11.5,-3)$:\MFPangle{11.5}{-3}\Z\w |
| 260 |
Angle of $(-11.5,4)$:\MFPangle{-11.5}{4}\Z\w |
| 261 |
Angle of $(11.5,-5)$:\MFPangle{11.5}{-5}\Z\w |
| 262 |
Angle of $(-11.5,6)$:\MFPangle{-11.5}{6}\Z\w |
| 263 |
Angle of $(11.5,-7)$:\MFPangle{11.5}{-7}\Z\w |
| 264 |
Angle of $(-11.5,8)$:\MFPangle{-11.5}{8}\Z\w |
| 265 |
Angle of $(11.5,-9)$:\MFPangle{11.5}{-9}\Z\w |
| 266 |
Angle of $(-11.5,10)$:\MFPangle{-11.5}{10}\Z\w |
| 267 |
Angle of $(11.5,-20)$:\MFPangle{11.5}{-20}\Z\w |
| 268 |
Angle of $(-11.5,30)$:\MFPangle{-11.5}{30}\Z\w |
| 269 |
Angle of $(11.5,-40)$:\MFPangle{11.5}{-40}\Z\w |
| 270 |
Angle of $(-11.5,50)$:\MFPangle{-11.5}{50}\Z\w |
| 271 |
Angle of $(11.5,-60)$:\MFPangle{11.5}{-60}\Z\w |
| 272 |
Angle of $(-11.5,70)$:\MFPangle{-11.5}{70}\Z\w |
| 273 |
Angle of $(11.5,-80)$:\MFPangle{11.5}{-80}\Z\w |
| 274 |
Angle of $(-11.5,90)$:\MFPangle{-11.5}{90}\Z\w |
| 275 |
Angle of $(11.5,-100)$:\MFPangle{11.5}{-100}\Z\w |
| 276 |
Angle of $(0,10)$:\MFPangle{0}{10}\Z\w |
| 277 |
Angle of $(0,-10)$:\MFPangle{0}{-10}\Z\w |
| 278 |
\immediate\write16{^^J*** The following tests the warning for angle of |
| 279 |
(0,0):^^J} |
| 280 |
Angle of $(0,0)$:\MFPangle{0}{0}\Z\W |
| 281 |
|
| 282 |
\noindent |
| 283 |
Testing large arguments:\\ |
| 284 |
Angle of $(85 713 000, 99 999 999)$:\MFPangle{8571 3000}{9999 9999}\Z\W |
| 285 |
|
| 286 |
|
| 287 |
\filbreak |
| 288 |
{\bf Extra tests of log}\\ |
| 289 |
Log of $.1$:\MFPlog{.1}\Z\w |
| 290 |
Log of $.2$:\MFPlog{.2}\Z\w |
| 291 |
Log of $.3$:\MFPlog{.3}\Z\w |
| 292 |
Log of $.4$:\MFPlog{.4}\Z\w |
| 293 |
Log of $.5$:\MFPlog{.5}\Z\w |
| 294 |
Log of $.6$:\MFPlog{.6}\Z\w |
| 295 |
Log of $.7$:\MFPlog{.7}\Z\w |
| 296 |
Log of $.8$:\MFPlog{.8}\Z\w |
| 297 |
Log of $.9$:\MFPlog{.9}\Z\w |
| 298 |
Log of $1$:\MFPlog{1}\Z\w |
| 299 |
Log of $1.01$:\MFPlog{1.01}\Z\w |
| 300 |
Log of $1.02$:\MFPlog{1.02}\Z\w |
| 301 |
Log of $1.03$:\MFPlog{1.03}\Z\w |
| 302 |
Log of $1.04$:\MFPlog{1.04}\Z\w |
| 303 |
Log of $1.05$:\MFPlog{1.05}\Z\w |
| 304 |
Log of $1.06$:\MFPlog{1.06}\Z\w |
| 305 |
Log of $1.07$:\MFPlog{1.07}\Z\w |
| 306 |
Log of $1.08$:\MFPlog{1.08}\Z\w |
| 307 |
Log of $1.09$:\MFPlog{1.09}\Z\w |
| 308 |
\immediate\write16{^^J*** The following tests the error for log of 0:^^J} |
| 309 |
Log of $0$:\MFPlog{0}\Z\W |
| 310 |
|
| 311 |
\filbreak |
| 312 |
{\bf Extra tests of exp}\\ |
| 313 |
Exp of $.00009990$:\MFPexp{.00009990}\Z |
| 314 |
\w |
| 315 |
Exp of $.00009999$:\MFPexp{.00009999}\Z\w |
| 316 |
Exp of $.0001$:\MFPexp{.0001}\Z\w |
| 317 |
Exp of $.0002$:\MFPexp{.0002}\Z\w |
| 318 |
Exp of $.0003$:\MFPexp{.0003}\Z\w |
| 319 |
Exp of $.0004$:\MFPexp{.0004}\Z\w |
| 320 |
Exp of $.0005$:\MFPexp{.0005}\Z\w |
| 321 |
Exp of $.0006$:\MFPexp{.0006}\Z\w |
| 322 |
Exp of $.0007$:\MFPexp{.0007}\Z\w |
| 323 |
Exp of $.0008$:\MFPexp{.0008}\Z\w |
| 324 |
Exp of $.0009$:\MFPexp{.0009}\Z\w |
| 325 |
Exp of $.001$:\MFPexp{.001}\Z\w |
| 326 |
Exp of $.002$:\MFPexp{.002}\Z\w |
| 327 |
Exp of $.003$:\MFPexp{.003}\Z\w |
| 328 |
Exp of $.004$:\MFPexp{.004}\Z\w |
| 329 |
Exp of $.005$:\MFPexp{.005}\Z\w |
| 330 |
Exp of $.006$:\MFPexp{.006}\Z\w |
| 331 |
Exp of $.007$:\MFPexp{.007}\Z\w |
| 332 |
Exp of $.008$:\MFPexp{.008}\Z\w |
| 333 |
Exp of $.009$:\MFPexp{.009}\Z\w |
| 334 |
Exp of $.01$:\MFPexp{.01}\Z\w |
| 335 |
Exp of $.02$:\MFPexp{.02}\Z\w |
| 336 |
Exp of $.03$:\MFPexp{.03}\Z\w |
| 337 |
Exp of $.04$:\MFPexp{.04}\Z\w |
| 338 |
Exp of $.05$:\MFPexp{.05}\Z\w |
| 339 |
Exp of $.06$:\MFPexp{.06}\Z\w |
| 340 |
Exp of $.07$:\MFPexp{.07}\Z\w |
| 341 |
Exp of $.08$:\MFPexp{.08}\Z\w |
| 342 |
Exp of $.09$:\MFPexp{.09}\Z\w |
| 343 |
Exp of $.1$:\MFPexp{.1}\Z\w |
| 344 |
Exp of $.2$:\MFPexp{.2}\Z\w |
| 345 |
Exp of $.3$:\MFPexp{.3}\Z\w |
| 346 |
Exp of $.4$:\MFPexp{.4}\Z\w |
| 347 |
Exp of $.5$:\MFPexp{.5}\Z\w |
| 348 |
Exp of $.6$:\MFPexp{.6}\Z\w |
| 349 |
Exp of $.7$:\MFPexp{.7}\Z\w |
| 350 |
Exp of $.8$:\MFPexp{.8}\Z\w |
| 351 |
Exp of $.9$:\MFPexp{.9}\Z\w |
| 352 |
Exp of $1$:\MFPexp{1}\Z\w |
| 353 |
Exp of $2$:\MFPexp{2}\Z\w |
| 354 |
Exp of $3$:\MFPexp{3}\Z\w |
| 355 |
Exp of $4$:\MFPexp{4}\Z\w |
| 356 |
Exp of $5$:\MFPexp{5}\Z\w |
| 357 |
Exp of $6$:\MFPexp{6}\Z\w |
| 358 |
Exp of $7$:\MFPexp{7}\Z\w |
| 359 |
Exp of $8$:\MFPexp{8}\Z\w |
| 360 |
Exp of $9$:\MFPexp{9}\Z\w |
| 361 |
Exp of $10$:\MFPexp{10}\Z\w |
| 362 |
Exp of $-8.3254$:\MFPexp{-8.3254}\Z\w |
| 363 |
Exp of $18.42068073$:\MFPexp{18.42068073}\Z\w |
| 364 |
Exp of $18.42068074$:\MFPexp{18.42068074}\Z\w |
| 365 |
\immediate\write16{^^J*** The following tests the error for a power too |
| 366 |
large:^^J} |
| 367 |
Exp of $18.42068075$:\MFPexp{18.42068075}\Z\W |
| 368 |
|
| 369 |
\filbreak |
| 370 |
{\bf Extra tests of pow}\\ |
| 371 |
$-10$ power of $3$:\MFPpow{3}{-10}\Z\w |
| 372 |
$-9$ power of $3$:\MFPpow{3}{-9}\Z\w |
| 373 |
$-8$ power of $3$:\MFPpow{3}{-8}\Z\w |
| 374 |
$-7$ power of $3$:\MFPpow{3}{-7}\Z\w |
| 375 |
$-6$ power of $3$:\MFPpow{3}{-6}\Z\w |
| 376 |
$-5$ power of $3$:\MFPpow{3}{-5}\Z\w |
| 377 |
$-4$ power of $3$:\MFPpow{3}{-4}\Z\w |
| 378 |
$-3$ power of $3$:\MFPpow{3}{-3}\Z\w |
| 379 |
$-2$ power of $3$:\MFPpow{3}{-2}\Z\w |
| 380 |
$-1$ power of $3$:\MFPpow{3}{-1}\Z\w |
| 381 |
$0$ power of $3$:\MFPpow{3}{0}\Z\w |
| 382 |
$1$ power of $3$:\MFPpow{3}{1}\Z\w |
| 383 |
$2$ power of $3$:\MFPpow{3}{2}\Z\w |
| 384 |
$3$ power of $3$:\MFPpow{3}{3}\Z\w |
| 385 |
$4$ power of $3$:\MFPpow{3}{4}\Z\w |
| 386 |
$5$ power of $3$:\MFPpow{3}{5}\Z\w |
| 387 |
$6$ power of $3$:\MFPpow{3}{6}\Z\w |
| 388 |
$7$ power of $3$:\MFPpow{3}{7}\Z\w |
| 389 |
$8$ power of $3$:\MFPpow{3}{8}\Z\w |
| 390 |
$9$ power of $3$:\MFPpow{3}{9}\Z\w |
| 391 |
$10$ power of $3$:\MFPpow{3}{10}\Z\w |
| 392 |
\immediate\write16{^^J*** The following tests the error for a power too |
| 393 |
large:^^J} |
| 394 |
$10$ power of $9$:\MFPpow{9}{10}\Z\w |
| 395 |
\immediate\write16{^^J*** The following also tests the error for a power too |
| 396 |
large:^^J} |
| 397 |
$10$ power of $-9$:\MFPpow{-9}{10}\Z\w |
| 398 |
\immediate\write16{^^J*** The following also tests the error for a power too |
| 399 |
large:^^J} |
| 400 |
$11$ power of $-9$:\MFPpow{-9}{11}\Z\w |
| 401 |
\immediate\write16{^^J*** The following tests the error for a negative power of |
| 402 |
0:^^J} |
| 403 |
$-10$ power of $0$:\MFPpow{0}{-10}\Z\w |
| 404 |
\immediate\write16{^^J*** The following also tests the error for a power too |
| 405 |
large:^^J} |
| 406 |
$-10$ power of $0.1$:\MFPpow{0.1}{-10}\Z\W |
| 407 |
|
| 408 |
\filbreak |
| 409 |
{\bf Extra tests of sqrt}\\ |
| 410 |
\immediate\write16{^^J*** The following tests the warning for a square root of a |
| 411 |
negative:^^J} |
| 412 |
Square root of $-1$:\MFPsqrt{-1}\Z\w |
| 413 |
Square root of $0$:\MFPsqrt{0}\Z\w |
| 414 |
Square root of $.0001$:\MFPsqrt{.0001}\Z\w |
| 415 |
Square root of $.002$:\MFPsqrt{.002}\Z\w |
| 416 |
Square root of $.03$:\MFPsqrt{.03}\Z\w |
| 417 |
Square root of $.4$:\MFPsqrt{.4}\Z\w |
| 418 |
Square root of $.5$:\MFPsqrt{.5}\Z\w |
| 419 |
Square root of $.6$:\MFPsqrt{.6}\Z\w |
| 420 |
Square root of $.7$:\MFPsqrt{.7}\Z\w |
| 421 |
Square root of $.8$:\MFPsqrt{.8}\Z\w |
| 422 |
Square root of $.9$:\MFPsqrt{.9}\Z\w |
| 423 |
Square root of $1$:\MFPsqrt{1}\Z\w |
| 424 |
Square root of $2$:\MFPsqrt{2}\Z\w |
| 425 |
Square root of $3$:\MFPsqrt{3}\Z\w |
| 426 |
Square root of $4$:\MFPsqrt{4}\Z\w |
| 427 |
Square root of $5$:\MFPsqrt{5}\Z\w |
| 428 |
Square root of $6$:\MFPsqrt{6}\Z\w |
| 429 |
Square root of $7$:\MFPsqrt{7}\Z\w |
| 430 |
Square root of $8$:\MFPsqrt{8}\Z\w |
| 431 |
Square root of $9$:\MFPsqrt{9}\Z\w |
| 432 |
Square root of $10$:\MFPsqrt{10}\Z\w |
| 433 |
Square root of $99$:\MFPsqrt{99}\Z\w |
| 434 |
Square root of $500$:\MFPsqrt{500}\Z\w |
| 435 |
Square root of $1000$:\MFPsqrt{1000}\Z\w |
| 436 |
Square root of $5000$:\MFPsqrt{5000}\Z\w |
| 437 |
Square root of $9999$:\MFPsqrt{9999}\Z\w |
| 438 |
Square root of $100000$:\MFPsqrt{100000}\Z\w |
| 439 |
Square root of $100000$:\MFPsqrt{100000}\Z\w |
| 440 |
Square root of $1500000$:\MFPsqrt{1500000}\Z\w |
| 441 |
Square root of $1524157.65279684$ (should be exact):\MFPsqrt{1524157.65279684}\Z\w |
| 442 |
Square root of $15000000$:\MFPsqrt{15000000}\Z\w |
| 443 |
Square root of $99999998.00000001$ (should be exact):\MFPsqrt{99999998.00000001}\Z\w |
| 444 |
Square root of $9999.99$:\MFPsqrt{9999.99}\Z\w |
| 445 |
Square root of $9999.999 999$:\MFPsqrt{9999.999999}\Z\W |
| 446 |
|
| 447 |
\filbreak |
| 448 |
{\bf Binary operations:}\\ |
| 449 |
Add $X+Y$:\MFPadd\X\Y\Z\w |
| 450 |
Add $\infty+\infty$:\MFPadd{99999999.99999999}{99999999.99999999}\Z\w |
| 451 |
Subtract $X-Y$:\MFPsub\X\Y\Z\w |
| 452 |
Subtract $Y-X$:\MFPsub\Y\X\Z\w |
| 453 |
Subtract $X-X$:\MFPsub\X\X\Z\w |
| 454 |
Subtract $Y-Y$:\MFPsub\Y\Y\Z\w |
| 455 |
Multiply:\MFPmul\X\Y\Z\w |
| 456 |
Multiply $10^{4}\times10^4$ (loses the overflow digit):\MFPmul{10000}{10000}\Z\w |
| 457 |
Divide $X/Y$:\MFPdiv\X\Y\Z\w |
| 458 |
Divide $Y/X$:\MFPdiv\Y\X\Z\w |
| 459 |
Max:\MFPmax\X\Y\Z\w |
| 460 |
Min:\MFPmin\X\Y\Z\w |
| 461 |
Angle $(X,Y)$:\MFPangle\X\Y\Z\w |
| 462 |
Angle $(Y,X)$:\MFPangle\Y\X\Z\w |
| 463 |
Power $X^5$:\MFPpow\X{5}\Z\w |
| 464 |
Power $X^{-5}$:\MFPpow\X{-5}\Z\w |
| 465 |
Power $Y^{5}$:\MFPpow\Y{5}\Z\w |
| 466 |
Power $Y^{-5}$:\MFPpow\Y{-5}\Z\w |
| 467 |
Compare: \MFPcmp\X\Y |
| 468 |
\X\ is\IFlt{}{ not} less than \Y. |
| 469 |
\X\ is\IFgt{}{ not} more than \Y. |
| 470 |
\X\ is\IFeq{}{ not} equal to \Y.\\ |
| 471 |
Take difference and check:\MFPsub\X\Y\Z\w |
| 472 |
$\X-\Y$ is\IFneg{}{ not} negative. |
| 473 |
$\X-\Y$ is\IFpos{}{ not} positive. |
| 474 |
$\X-\Y$ is\IFzero{}{ not} zero. |
| 475 |
|
| 476 |
\filbreak |
| 477 |
{\bf Print-related formating} |
| 478 |
|
| 479 |
\def\T{333.00000000} |
| 480 |
\def\S{1357.12345678} |
| 481 |
|
| 482 |
\noindent This is original: $T ={}${\tt"\T"}\\ |
| 483 |
Truncate to 4 digits right of decimal:\MFPtruncate{4}\T\Z\w |
| 484 |
Truncate to the decimal:\MFPtruncate{0}\T\Z\w |
| 485 |
Truncate to 2 digits left of decimal:\MFPtruncate{-2}\T\Z\w |
| 486 |
Strip trailing zeros:\MFPstrip\T\Z\w |
| 487 |
Strip trailing zeros (star form):\MFPstrip*\T\Z\W |
| 488 |
|
| 489 |
\noindent Original: $S = {}${\tt"\S"}\\ |
| 490 |
Round to 3 decimals:\MFPround{3}\S\Z\w |
| 491 |
Round to 5 decimals:\MFPround{5}\S\Z\w |
| 492 |
Round to 0 decimals:\MFPround{0}\S\Z\w |
| 493 |
Round to 100s:\MFPround{-2}\S\Z\W |
| 494 |
|
| 495 |
\def\T{-333.00000000} |
| 496 |
\def\S{-1357.12345678} |
| 497 |
|
| 498 |
\filbreak |
| 499 |
\noindent All that again with negative numbers. |
| 500 |
|
| 501 |
\medskip |
| 502 |
\noindent This is original: $T ={}${\tt"\T"}\\ |
| 503 |
Truncate to 4 digits right of decimal:\MFPtruncate{4}\T\Z\w |
| 504 |
Truncate to the decimal:\MFPtruncate{0}\T\Z\w |
| 505 |
Truncate to 2 digits left of decimal:\MFPtruncate{-2}\T\Z\w |
| 506 |
Strip trailing zeros:\MFPstrip\T\Z\w |
| 507 |
Strip trailing zeros (star form):\MFPstrip*\T\Z\W |
| 508 |
|
| 509 |
\noindent Original: $S = {}${\tt"\S"}\\ |
| 510 |
Round to 3 decimals:\MFPround{3}\S\Z\w |
| 511 |
Round to 5 decimals:\MFPround{5}\S\Z\w |
| 512 |
Round to 0 decimals:\MFPround{0}\S\Z\w |
| 513 |
Round to 100s:\MFPround{-2}\S\Z\W |
| 514 |
|
| 515 |
\end{document} |