1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>/Volumes/unix-files/u/ntl-new/ntl-9.9.0dev/doc/RR.cpp.html</title>
<meta name="Generator" content="Vim/7.1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000"><font face="monospace">
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i>MODULE: RR</i></font><br>
<br>
<font color="#0000ed"><i>SUMMARY:</i></font><br>
<br>
<font color="#0000ed"><i>The class RR is used to represent arbitrary-precision floating point</i></font><br>
<font color="#0000ed"><i>numbers.</i></font><br>
<br>
<font color="#0000ed"><i>The functions in this module guarantee very strong accuracy conditions</i></font><br>
<font color="#0000ed"><i>which make it easy to reason about the behavior of programs using</i></font><br>
<font color="#0000ed"><i>these functions.</i></font><br>
<br>
<font color="#0000ed"><i>The arithmetic operations always round their results to p bits, where</i></font><br>
<font color="#0000ed"><i>p is the current precision. The current precision can be changed</i></font><br>
<font color="#0000ed"><i>using RR::SetPrecision(), and can be read using RR::precision(). </i></font><br>
<br>
<font color="#0000ed"><i>The minimum precision that can be set is 53 bits.</i></font><br>
<font color="#0000ed"><i>The maximum precision is limited only by the word size of the machine.</i></font><br>
<br>
<font color="#0000ed"><i>A convenience class RRPush is provided to automatically save and</i></font><br>
<font color="#0000ed"><i>restore the current precision.</i></font><br>
<br>
<font color="#0000ed"><i>All arithmetic operations are implemented so that the effect is as if the</i></font><br>
<font color="#0000ed"><i>result was computed exactly, and then rounded to p bits. If a number</i></font><br>
<font color="#0000ed"><i>lies exactly half-way between two p-bit numbers, the "round to even"</i></font><br>
<font color="#0000ed"><i>rule is used. So in particular, the computed result will have a relative error</i></font><br>
<font color="#0000ed"><i>of at most 2^{-p}.</i></font><br>
<br>
<br>
<font color="#0000ed"><i>The above rounding rules apply to all arithmetic operations in this</i></font><br>
<font color="#0000ed"><i>module, except for the following routines:</i></font><br>
<br>
<font color="#0000ed"><i>* The transcendental functions: </i></font><br>
<font color="#0000ed"><i> log, exp, log10, expm1, log1p, pow, sin, cos, ComputePi</i></font><br>
<br>
<font color="#0000ed"><i>* The power function</i></font><br>
<br>
<font color="#0000ed"><i>* The input and ascii to RR conversion functions when using "e"-notation </i></font><br>
<br>
<font color="#0000ed"><i>For these functions, a very strong accuracy condition is still </i></font><br>
<font color="#0000ed"><i>guaranteed: the computed result has a relative error of less than 2^{-p + 1}</i></font><br>
<font color="#0000ed"><i>(and actually much closer to 2^{-p}).</i></font><br>
<font color="#0000ed"><i>That is, it is as if the resulted were computed exactly, and then</i></font><br>
<font color="#0000ed"><i>rounded to one of the two neighboring p-bit numbers (but not necessarily</i></font><br>
<font color="#0000ed"><i>the closest).</i></font><br>
<br>
<font color="#0000ed"><i>The behavior of all functions in this module is completely platform </i></font><br>
<font color="#0000ed"><i>independent: you should get *exactly* the same results on any platform</i></font><br>
<font color="#0000ed"><i>(the only exception to this rule is the random number generator).</i></font><br>
<br>
<font color="#0000ed"><i>Note that because precision is variable, a number may be computed with</i></font><br>
<font color="#0000ed"><i>to a high precision p', and then be used as input to an arithmetic operation</i></font><br>
<font color="#0000ed"><i>when the current precision is p < p'. </i></font><br>
<font color="#0000ed"><i>The above accuracy guarantees still apply; in particular, </i></font><br>
<font color="#0000ed"><i>no rounding is done until *after* the operation is performed. </i></font><br>
<br>
<font color="#0000ed"><i>EXAMPLE: If x and y are computed to 200 bits of precision,</i></font><br>
<font color="#0000ed"><i>and then the precision is set to 100 bits, then x-y will</i></font><br>
<font color="#0000ed"><i>be computed correctly to 100 bits, even if, say, x and y agree</i></font><br>
<font color="#0000ed"><i>in their high-order 50 bits. If x and y had been rounded to</i></font><br>
<font color="#0000ed"><i>100 bits before the subtraction, then the difference would</i></font><br>
<font color="#0000ed"><i>only be accurate to 50 bits of precision.</i></font><br>
<br>
<font color="#0000ed"><i>Note that the assignment operator and the copy constructor </i></font><br>
<font color="#0000ed"><i>produce *exact* copies of their inputs---they are *never* rounded. </i></font><br>
<font color="#0000ed"><i>This is a change in semantics from versions 2.0 and earlier</i></font><br>
<font color="#0000ed"><i>in which assignment and copy rounded their outputs.</i></font><br>
<font color="#0000ed"><i>This was deemed a design error and has been changed.</i></font><br>
<br>
<font color="#0000ed"><i>If you want to force rounding to current precision, the easiest</i></font><br>
<font color="#0000ed"><i>way to do this is with the RR to RR conversion routines:</i></font><br>
<font color="#0000ed"><i> conv(x, a);</i></font><br>
<font color="#0000ed"><i>or</i></font><br>
<font color="#0000ed"><i> x = to_RR(a); </i></font><br>
<font color="#0000ed"><i>This will round a to current precision and store the result in x.</i></font><br>
<font color="#0000ed"><i>Note that writing</i></font><br>
<font color="#0000ed"><i> x = a + 0;</i></font><br>
<font color="#0000ed"><i>or</i></font><br>
<font color="#0000ed"><i> x = a*1;</i></font><br>
<font color="#0000ed"><i>also has the same effect.</i></font><br>
<br>
<font color="#0000ed"><i>Unlike IEEE standard floating point, there are no "special values",</i></font><br>
<font color="#0000ed"><i>like "infinity" or "not a number", nor are there any "denormalized</i></font><br>
<font color="#0000ed"><i>numbers". Overflow, underflow, or taking a square root of a negative</i></font><br>
<font color="#0000ed"><i>number all result in an error being raised.</i></font><br>
<br>
<font color="#0000ed"><i>An RR is represented as a mantissa/exponent pair (x, e), where x is a</i></font><br>
<font color="#0000ed"><i>ZZ and e is a long. The real number represented by (x, e) is x * 2^e.</i></font><br>
<font color="#0000ed"><i>Zero is always represented as (0, 0). For all other numbers, x is</i></font><br>
<font color="#0000ed"><i>always odd.</i></font><br>
<br>
<br>
<font color="#0000ed"><i>CONVERSIONS AND PROMOTIONS:</i></font><br>
<font color="#0000ed"><i>The complete set of conversion routines between RR and other types is</i></font><br>
<font color="#0000ed"><i>documented in the file "conversions.txt". Conversion from any type</i></font><br>
<font color="#0000ed"><i>to RR always rounds the result to the current precision.</i></font><br>
<br>
<font color="#0000ed"><i>The basic operations also support the notion of "promotions", </i></font><br>
<font color="#0000ed"><i>so that they promote a double to an RR. For example, one can write </i></font><br>
<font color="#0000ed"><i> x = y + 1.5;</i></font><br>
<font color="#0000ed"><i>where x and y are RR's. One should be aware that these promotions are </i></font><br>
<font color="#0000ed"><i>always implemented using the double to RR conversion routine.</i></font><br>
<br>
<br>
<font color="#0000ed"><i>SIZE INVARIANT: max(NumBits(x), |e|) < 2^(NTL_BITS_PER_LONG-4)</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<br>
<br>
<font color="#1773cc">#include </font><font color="#4a6f8b"><NTL/ZZ.h></font><br>
<font color="#1773cc">#include </font><font color="#4a6f8b"><NTL/xdouble.h></font><br>
<font color="#1773cc">#include </font><font color="#4a6f8b"><NTL/quad_float.h></font><br>
<br>
<font color="#008b00"><b>class</b></font> RR {<br>
<br>
<font color="#b02f60"><b>public</b></font>:<br>
<br>
RR(); <font color="#0000ed"><i>// = 0</i></font><br>
<br>
RR(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// copy constructor</i></font><br>
<br>
<br>
<font color="#008b00"><b>explicit</b></font> RR(<font color="#008b00"><b>double</b></font> a); <font color="#0000ed"><i>// promotion constructor</i></font><br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>=(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// assignment operator</i></font><br>
<br>
<font color="#0000ed"><i>// NOTE: the copy constructor and assignment operator</i></font><br>
<font color="#0000ed"><i>// produce exact copies of their inputs, and do not round</i></font><br>
<font color="#0000ed"><i>// to current precision. </i></font><br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>=(<font color="#008b00"><b>double</b></font> a); <font color="#0000ed"><i>// convert and assign</i></font><br>
<br>
~RR(); <font color="#0000ed"><i>// destructor</i></font><br>
<br>
<font color="#008b00"><b>const</b></font> ZZ& mantissa() <font color="#008b00"><b>const</b></font>; <font color="#0000ed"><i>// read the mantissa</i></font><br>
<font color="#008b00"><b>long</b></font> exponent() <font color="#008b00"><b>const</b></font>; <font color="#0000ed"><i>// read the exponent</i></font><br>
<br>
<font color="#008b00"><b>static</b></font> <font color="#008b00"><b>void</b></font> SetPrecision(<font color="#008b00"><b>long</b></font> p); <br>
<font color="#0000ed"><i>// set current precision to max(p, 53) bits.</i></font><br>
<font color="#0000ed"><i>// The default is 150</i></font><br>
<br>
<font color="#008b00"><b>static</b></font> <font color="#008b00"><b>long</b></font> precision(); <font color="#0000ed"><i>// read current value of precision</i></font><br>
<br>
<font color="#008b00"><b>static</b></font> <font color="#008b00"><b>void</b></font> SetOutputPrecision(<font color="#008b00"><b>long</b></font> p); <br>
<font color="#0000ed"><i>// set the number of output decimal digits to max(p, 1).</i></font><br>
<font color="#0000ed"><i>// The default is 10</i></font><br>
<br>
<font color="#008b00"><b>static</b></font> <font color="#008b00"><b>long</b></font> OutputPrecision();<br>
<font color="#0000ed"><i>// read the current number of output decimal digits</i></font><br>
<br>
<br>
};<br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Comparison</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<br>
<font color="#0000ed"><i>// standard comparison operators:</i></font><br>
<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font>==(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font>!=(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font><=(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font>>=(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font> <(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<font color="#008b00"><b>long</b></font> <font color="#b02f60"><b>operator</b></font> >(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<br>
<br>
<font color="#008b00"><b>long</b></font> IsZero(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// test if 0</i></font><br>
<font color="#008b00"><b>long</b></font> IsOne(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// test if 1</i></font><br>
<br>
<font color="#008b00"><b>long</b></font> sign(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// returns sign of a (+1, -1, 0)</i></font><br>
<font color="#008b00"><b>long</b></font> compare(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b); <font color="#0000ed"><i>// returns sign(a-b);</i></font><br>
<br>
<font color="#0000ed"><i>// PROMOTIONS: operators ==, ..., > and function compare</i></font><br>
<font color="#0000ed"><i>// promote double to RR on (a, b).</i></font><br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Addition</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<font color="#0000ed"><i>// operator notation:</i></font><br>
<br>
RR <font color="#b02f60"><b>operator</b></font>+(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
RR <font color="#b02f60"><b>operator</b></font>-(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
RR <font color="#b02f60"><b>operator</b></font>-(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// unary -</i></font><br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>+=(RR& x, <font color="#008b00"><b>const</b></font> RR& a);<br>
RR& <font color="#b02f60"><b>operator</b></font>+=(RR& x, <font color="#008b00"><b>double</b></font> a);<br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>-=(RR& x, <font color="#008b00"><b>const</b></font> RR& a);<br>
RR& <font color="#b02f60"><b>operator</b></font>-=(RR& x, <font color="#008b00"><b>double</b></font> a);<br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>++(RR& x); <font color="#0000ed"><i>// prefix</i></font><br>
<font color="#008b00"><b>void</b></font> <font color="#b02f60"><b>operator</b></font>++(RR& x, <font color="#008b00"><b>int</b></font>); <font color="#0000ed"><i>// postfix</i></font><br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>--(RR& x); <font color="#0000ed"><i>// prefix</i></font><br>
<font color="#008b00"><b>void</b></font> <font color="#b02f60"><b>operator</b></font>--(RR& x, <font color="#008b00"><b>int</b></font>); <font color="#0000ed"><i>// postfix</i></font><br>
<br>
<br>
<font color="#0000ed"><i>// procedural versions:</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> add(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b); <font color="#0000ed"><i>// z = a+b</i></font><br>
<font color="#008b00"><b>void</b></font> sub(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b); <font color="#0000ed"><i>// z = a-b</i></font><br>
<font color="#008b00"><b>void</b></font> negate(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = -a</i></font><br>
<br>
<font color="#0000ed"><i>// PROMOTIONS: operators +, -, and procedures add, sub promote double</i></font><br>
<font color="#0000ed"><i>// to RR on (a, b).</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> abs(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = |a|</i></font><br>
RR fabs(<font color="#008b00"><b>const</b></font> RR& a); <br>
RR abs(<font color="#008b00"><b>const</b></font> RR& a); <br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Multiplication</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#0000ed"><i>// operator notation:</i></font><br>
<br>
RR <font color="#b02f60"><b>operator</b></font>*(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>*=(RR& x, <font color="#008b00"><b>const</b></font> RR& a);<br>
RR& <font color="#b02f60"><b>operator</b></font>*=(RR& x, <font color="#008b00"><b>double</b></font> a);<br>
<br>
<font color="#0000ed"><i>// procedural versions:</i></font><br>
<br>
<br>
<font color="#008b00"><b>void</b></font> mul(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b); <font color="#0000ed"><i>// z = a*b</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> sqr(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a * a</i></font><br>
RR sqr(<font color="#008b00"><b>const</b></font> RR& a); <br>
<br>
<font color="#0000ed"><i>// PROMOTIONS: operator * and procedure mul promote double to RR on (a, b).</i></font><br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Division</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#0000ed"><i>// operator notation:</i></font><br>
<br>
RR <font color="#b02f60"><b>operator</b></font>/(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b);<br>
<br>
RR& <font color="#b02f60"><b>operator</b></font>/=(RR& x, <font color="#008b00"><b>const</b></font> RR& a);<br>
RR& <font color="#b02f60"><b>operator</b></font>/=(RR& x, <font color="#008b00"><b>double</b></font> a);<br>
<br>
<br>
<font color="#0000ed"><i>// procedural versions:</i></font><br>
<br>
<br>
<font color="#008b00"><b>void</b></font> div(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b); z = a/b<br>
<br>
<font color="#008b00"><b>void</b></font> inv(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = 1 / a</i></font><br>
RR inv(<font color="#008b00"><b>const</b></font> RR& a); <br>
<br>
<font color="#0000ed"><i>// PROMOTIONS: operator / and procedure div promote double to RR on (a, b).</i></font><br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Transcendental functions </i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#008b00"><b>void</b></font> exp(RR& res, <font color="#008b00"><b>const</b></font> RR& x); <font color="#0000ed"><i>// e^x</i></font><br>
RR exp(<font color="#008b00"><b>const</b></font> RR& x); <br>
<br>
<font color="#008b00"><b>void</b></font> log(RR& res, <font color="#008b00"><b>const</b></font> RR& x); <font color="#0000ed"><i>// log(x) (natural log)</i></font><br>
RR log(<font color="#008b00"><b>const</b></font> RR& x); <br>
<br>
<font color="#008b00"><b>void</b></font> log10(RR& res, <font color="#008b00"><b>const</b></font> RR& x); <font color="#0000ed"><i>// log(x)/log(10)</i></font><br>
RR log10(<font color="#008b00"><b>const</b></font> RR& x); <br>
<br>
<font color="#008b00"><b>void</b></font> expm1(RR& res, <font color="#008b00"><b>const</b></font> RR& x);<br>
RR expm1(<font color="#008b00"><b>const</b></font> RR& x); <br>
<font color="#0000ed"><i>// e^(x)-1; more accurate than exp(x)-1 when |x| is small</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> log1p(RR& res, <font color="#008b00"><b>const</b></font> RR& x);<br>
RR log1p(<font color="#008b00"><b>const</b></font> RR& x); <br>
<font color="#0000ed"><i>// log(1 + x); more accurate than log(1 + x) when |x| is small</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> pow(RR& res, <font color="#008b00"><b>const</b></font> RR& x, <font color="#008b00"><b>const</b></font> RR& y); <font color="#0000ed"><i>// x^y</i></font><br>
RR pow(<font color="#008b00"><b>const</b></font> RR& x, <font color="#008b00"><b>const</b></font> RR& y); <br>
<br>
<font color="#008b00"><b>void</b></font> sin(RR& res, <font color="#008b00"><b>const</b></font> RR& x); <font color="#0000ed"><i>// sin(x); restriction: |x| < 2^1000</i></font><br>
RR sin(<font color="#008b00"><b>const</b></font> RR& x); <br>
<br>
<font color="#008b00"><b>void</b></font> cos(RR& res, <font color="#008b00"><b>const</b></font> RR& x); <font color="#0000ed"><i>// cos(x); restriction: |x| < 2^1000</i></font><br>
RR cos(<font color="#008b00"><b>const</b></font> RR& x); <br>
<br>
<font color="#008b00"><b>void</b></font> ComputePi(RR& pi); <font color="#0000ed"><i>// approximate pi to current precision</i></font><br>
RR ComputePi_RR();<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Rounding to integer values </i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>** RR output **</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> trunc(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to 0</i></font><br>
RR trunc(<font color="#008b00"><b>const</b></font> RR& a);<br>
<br>
<font color="#008b00"><b>void</b></font> floor(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to -infinity</i></font><br>
RR floor(<font color="#008b00"><b>const</b></font> RR& a);<br>
<br>
<font color="#008b00"><b>void</b></font> ceil(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to +infinity</i></font><br>
RR ceil(<font color="#008b00"><b>const</b></font> RR& a);<br>
<br>
<font color="#008b00"><b>void</b></font> round(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to nearest integer</i></font><br>
RR round(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// ties are rounded to an even integer</i></font><br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>** ZZ output **</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> TruncToZZ(ZZ& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to 0</i></font><br>
ZZ TruncToZZ(<font color="#008b00"><b>const</b></font> RR& a);<br>
<br>
<font color="#008b00"><b>void</b></font> FloorToZZ(ZZ& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to -infinity</i></font><br>
ZZ FloorToZZ(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// same as RR to ZZ conversion</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> CeilToZZ(ZZ& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to +infinity</i></font><br>
ZZ CeilToZZ(<font color="#008b00"><b>const</b></font> ZZ& a);<br>
<br>
<font color="#008b00"><b>void</b></font> RoundToZZ(ZZ& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = a, truncated to nearest integer</i></font><br>
ZZ RoundToZZ(<font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// ties are rounded to an even integer</i></font><br>
<br>
<br>
<br>
<a name="push"></a>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Saving and restoring the current precision</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#008b00"><b>class</b></font> RRPush {<br>
<font color="#b02f60"><b>public</b></font>:<br>
RRPush(); <font color="#0000ed"><i>// saves the cuurent precision</i></font><br>
~RRPush(); <font color="#0000ed"><i>// restores the saved precision</i></font><br>
<br>
<font color="#b02f60"><b>private</b></font>: <br>
RRPush(<font color="#008b00"><b>const</b></font> RRPush&); <font color="#0000ed"><i>// disable</i></font><br>
<font color="#008b00"><b>void</b></font> <font color="#b02f60"><b>operator</b></font>=(<font color="#008b00"><b>const</b></font> RRPush&); <font color="#0000ed"><i>// disable</i></font><br>
};<br>
<br>
<br>
<font color="#0000ed"><i>// Example: </i></font><br>
<font color="#0000ed"><i>//</i></font><br>
<font color="#0000ed"><i>// {</i></font><br>
<font color="#0000ed"><i>// RRPush push; // don't forget to declare a variable!!</i></font><br>
<font color="#0000ed"><i>// RR::SetPrecsion(new_p);</i></font><br>
<font color="#0000ed"><i>// ...</i></font><br>
<font color="#0000ed"><i>// } // old precsion restored when scope is exited</i></font><br>
<br>
<br>
<font color="#008b00"><b>class</b></font> RROutputPush {<br>
<font color="#b02f60"><b>public</b></font>:<br>
RROutputPush(); <font color="#0000ed"><i>// saves the cuurent output precision</i></font><br>
~RROutputPush(); <font color="#0000ed"><i>// restores the saved output precision</i></font><br>
<br>
<font color="#b02f60"><b>private</b></font>: <br>
RROutputPush(<font color="#008b00"><b>const</b></font> RROutputPush&); <font color="#0000ed"><i>// disable</i></font><br>
<font color="#008b00"><b>void</b></font> <font color="#b02f60"><b>operator</b></font>=(<font color="#008b00"><b>const</b></font> RROutputPush&); <font color="#0000ed"><i>// disable</i></font><br>
};<br>
<br>
<br>
<font color="#0000ed"><i>// Example: </i></font><br>
<font color="#0000ed"><i>//</i></font><br>
<font color="#0000ed"><i>// {</i></font><br>
<font color="#0000ed"><i>// RROutputPush push; // don't forget to declare a variable!!</i></font><br>
<font color="#0000ed"><i>// RR::SetOutputPrecsion(new_op);</i></font><br>
<font color="#0000ed"><i>// ...</i></font><br>
<font color="#0000ed"><i>// } // old output precsion restored when scope is exited</i></font><br>
<br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Miscelaneous</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<font color="#008b00"><b>void</b></font> MakeRR(RR& z, <font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> e);<br>
RR MakeRR(<font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> e);<br>
<font color="#0000ed"><i>// z = a*2^e, rounded to current precision</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> random(RR& z);<br>
RR random_RR(); <br>
<font color="#0000ed"><i>// z = pseudo-random number in the range [0,1).</i></font><br>
<font color="#0000ed"><i>// Note that the behaviour of this function is somewhat platform</i></font><br>
<font color="#0000ed"><i>// dependent, because the underlying pseudo-ramdom generator is.</i></font><br>
<br>
<br>
<font color="#008b00"><b>void</b></font> SqrRoot(RR& z, <font color="#008b00"><b>const</b></font> RR& a); <font color="#0000ed"><i>// z = sqrt(a);</i></font><br>
RR SqrRoot(<font color="#008b00"><b>const</b></font> RR& a);<br>
RR sqrt(<font color="#008b00"><b>const</b></font> RR& a);<br>
<br>
<font color="#008b00"><b>void</b></font> power(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> e); <font color="#0000ed"><i>// z = a^e, e may be negative</i></font><br>
RR power(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> e); <br>
<br>
<font color="#008b00"><b>void</b></font> power2(RR& z, <font color="#008b00"><b>long</b></font> e); <font color="#0000ed"><i>// z = 2^e, e may be negative</i></font><br>
RR power2_RR(<font color="#008b00"><b>long</b></font> e); <br>
<br>
<br>
<font color="#008b00"><b>void</b></font> clear(RR& z); <font color="#0000ed"><i>// z = 0</i></font><br>
<font color="#008b00"><b>void</b></font> set(RR& z); <font color="#0000ed"><i>// z = 1</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> RR::swap(RR& a);<br>
<font color="#008b00"><b>void</b></font> swap(RR& a, RR& b); <br>
<font color="#0000ed"><i>// swap (pointer swap)</i></font><br>
<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i> Input/Output</i></font><br>
<font color="#0000ed"><i>Input Syntax:</i></font><br>
<br>
<font color="#0000ed"><i><number>: [ "-" ] <unsigned-number></i></font><br>
<font color="#0000ed"><i><unsigned-number>: <dotted-number> [ <e-part> ] | <e-part></i></font><br>
<font color="#0000ed"><i><dotted-number>: <digits> | <digits> "." <digits> | "." <digits> | <digits> "."</i></font><br>
<font color="#0000ed"><i><digits>: <digit> <digits> | <digit></i></font><br>
<font color="#0000ed"><i><digit>: "0" | ... | "9"</i></font><br>
<font color="#0000ed"><i><e-part>: ( "E" | "e" ) [ "+" | "-" ] <digits></i></font><br>
<br>
<font color="#0000ed"><i>Examples of valid input:</i></font><br>
<br>
<font color="#0000ed"><i>17 1.5 0.5 .5 5. -.5 e10 e-10 e+10 1.5e10 .5e10 .5E10</i></font><br>
<br>
<font color="#0000ed"><i>Note that the number of decimal digits of precision that are used</i></font><br>
<font color="#0000ed"><i>for output can be set to any number p >= 1 by calling</i></font><br>
<font color="#0000ed"><i>the routine RR::SetOutputPrecision(p). The default value of p is 10.</i></font><br>
<font color="#0000ed"><i>The current value of p is returned by a call to RR::OutputPrecision().</i></font><br>
<br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<br>
ostream& <font color="#b02f60"><b>operator</b></font><<(ostream& s, <font color="#008b00"><b>const</b></font> RR& a);<br>
istream& <font color="#b02f60"><b>operator</b></font>>>(istream& s, RR& x);<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<br>
<font color="#0000ed"><i> Specialized routines with explicit precision parameter</i></font><br>
<br>
<font color="#0000ed"><i>These routines take an explicit precision parameter p. The value of p may be</i></font><br>
<font color="#0000ed"><i>any positive integer. All results are computed to *precisely* p bits of</i></font><br>
<font color="#0000ed"><i>precision, regardless of the current precision (as set by RR::SetPrecision).</i></font><br>
<br>
<font color="#0000ed"><i>These routines are provided both for convenience and for situations where the</i></font><br>
<font color="#0000ed"><i>computation must be done with a precision that may be less than 53.</i></font><br>
<br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
<br>
<br>
<font color="#008b00"><b>void</b></font> AddPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a + b</i></font><br>
RR AddPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> SubPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a - b</i></font><br>
RR SubPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> NegatePrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = -a</i></font><br>
RR NegatePrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> AbsPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = |a|</i></font><br>
RR AbsPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> MulPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a*b</i></font><br>
RR MulPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> SqrPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a*a</i></font><br>
RR SqrPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> DivPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a/b</i></font><br>
RR DivPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>const</b></font> RR& b, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> InvPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = 1/a</i></font><br>
RR DivPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> SqrRootPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = sqrt(a)</i></font><br>
RR SqrRootPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> TruncPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a, truncated to 0</i></font><br>
RR TruncPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> FloorPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a, truncated to -infinity</i></font><br>
RR FloorPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> CeilPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a, truncated to +infinity</i></font><br>
RR CeilPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> RoundPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a, </i></font><br>
<font color="#0000ed"><i>// truncated to nearest integer,</i></font><br>
<font color="#0000ed"><i>// ties are roundec to an even </i></font><br>
<font color="#0000ed"><i>// integer</i></font><br>
RR RoundPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>const</b></font> RR& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>long</b></font> a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>long</b></font> a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>int</b></font> a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>int</b></font> a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>unsigned</b></font> <font color="#008b00"><b>long</b></font> a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>unsigned</b></font> <font color="#008b00"><b>long</b></font> a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>unsigned</b></font> <font color="#008b00"><b>int</b></font> a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a </i></font><br>
RR ConvPrec(<font color="#008b00"><b>unsigned</b></font> <font color="#008b00"><b>int</b></font> a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>double</b></font> a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>double</b></font> a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>const</b></font> xdouble& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>const</b></font> xdouble& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>const</b></font> quad_float& a, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a</i></font><br>
RR ConvPrec(<font color="#008b00"><b>const</b></font> quad_float& a, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<font color="#008b00"><b>void</b></font> ConvPrec(RR& z, <font color="#008b00"><b>const</b></font> <font color="#008b00"><b>char</b></font> *s, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// read z from s</i></font><br>
RR ConvPrec(<font color="#008b00"><b>const</b></font> <font color="#008b00"><b>char</b></font> *s, <font color="#008b00"><b>long</b></font> p);<br>
<br>
istream& InputPrec(RR& z, istream& s, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// read z from s</i></font><br>
RR InputPrec(istream& s, <font color="#008b00"><b>long</b></font> p);<br>
<font color="#0000ed"><i>// The functional variant raises an error if input</i></font><br>
<font color="#0000ed"><i>// is missing or ill-formed, while procedural form</i></font><br>
<font color="#0000ed"><i>// does not.</i></font><br>
<br>
<font color="#008b00"><b>void</b></font> MakeRRPrec(RR& z, <font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> e, <font color="#008b00"><b>long</b></font> p); <font color="#0000ed"><i>// z = a*2^e</i></font><br>
RR MakeRRPrec(<font color="#008b00"><b>const</b></font> ZZ& a, <font color="#008b00"><b>long</b></font> e, <font color="#008b00"><b>long</b></font> p);<br>
<br>
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i>COMPATABILITY NOTES: </i></font><br>
<br>
<font color="#0000ed"><i> (1) Prior to version 5.3, the documentation indicated that under certain</i></font><br>
<font color="#0000ed"><i> circumstances, the value of the current precision could be directly set</i></font><br>
<font color="#0000ed"><i> by setting the variable RR::prec. Such usage is now considered</i></font><br>
<font color="#0000ed"><i> obsolete. To perform computations using a precision of less than 53</i></font><br>
<font color="#0000ed"><i> bits, users should use the specialized routines AddPrec, SubPrec, etc.,</i></font><br>
<font color="#0000ed"><i> documented above.</i></font><br>
<br>
<font color="#0000ed"><i> (2) The routine RoundToPrecision is obsolete, although for backward</i></font><br>
<font color="#0000ed"><i> compatability, it is still declared (in both procedural and function</i></font><br>
<font color="#0000ed"><i> forms), and is equivalent to ConvPrec.</i></font><br>
<br>
<font color="#0000ed"><i> (3) In versions 2.0 and earlier, the assignment operator and copy</i></font><br>
<font color="#0000ed"><i> constructor for the class RR rounded their outputs to the current</i></font><br>
<font color="#0000ed"><i> precision. This is no longer the case: their outputs are now exact</i></font><br>
<font color="#0000ed"><i> copies of their inputs, regardless of the current precision.</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<br>
</font></body>
</html>
|