diff6-10.chapter22.txtこのページは最後に更新されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。 last mod. 2008-08-28 (木) 09:57:28
28,30c28,29 < Numbers (type num) are arbitrary-precision rational numbers, plus the < special elements 1/0 (infinity) and 0/0 (undefined). < --- > Numbers (type num) are arbitrary-precision rational numbers, plus the special > elements 1/0 (infinity) and 0/0 (undefined). 47d45 < 54,55d51 < < 62,63d57 < < 70,71d63 < < 78,79d69 < < 86,87d75 < < 94,95d81 < < 102,103d87 < < 110,111d93 < < 118,119d99 < < 126,127d105 < < 134,135d111 < < 142,143d117 < < 150,151d123 < < 158,159d129 < < 166,167d135 < < 174,175d141 < < 182,183d147 < < 190,191d153 < < 198,199d159 < < 206d165 < 208d166 < 213,216c171,172 < integer_num n returns the integer closest to n. In case of < ties, rounds towards zero. < < --- > integer_num n returns the integer closest to n. In case of ties, rounds > towards zero. 224,225d179 < < 230,233c184,185 < round_num n returns the integer closest to n. In case of ties, < rounds off zero. < < --- > round_num n returns the integer closest to n. In case of ties, rounds off > zero. 239,242c191 < ceiling_num n returns the smallest integer bigger or equal to < n. < < --- > ceiling_num n returns the smallest integer bigger or equal to n. 255d203 < 260d207 < 265d211 < 270d215 < 275d219 < 280d223 < 285d227 < 290d231 < 295d235 < 300d239 < 305d243 < 310d247 < 315,318c252,253 < Return -1, 0 or 1 if the first argument is less than, equal < to, or greater than the second argument. < < --- > Return -1, 0 or 1 if the first argument is less than, equal to, or greater > than the second argument. 326,327d260 < < 339d271 < 346,347d277 < < 354,355d283 < < 360,367c288,293 < Approximate a number by a decimal. The first argument is the < required precision. The second argument is the number to < approximate. Num.approx_num_fix[22.1] uses decimal notation; the < first argument is the number of digits after the decimal point. < approx_num_exp uses scientific (exponential) notation; the < first argument is the number of digits in the mantissa. < < --- > Approximate a number by a decimal. The first argument is the required > precision. The second argument is the number to approximate. > Num.approx_num_fix[22.1] uses decimal notation; the first argument is the > number of digits after the decimal point. approx_num_exp uses scientific > (exponential) notation; the first argument is the number of digits in the > mantissa. 380d305 < 385d309 < 390d313 < 395d317 < 400d321 < 405d325 < 410d329 < 415d333 < 420d337 < 434d350 < 441,442d356 < < 449,450d362 < < 462d373 < 469,470d379 < < 477,478d385 < < 485,486d391 < < 493,494d397 < < 501,502d403 < < 509,510d409 < < 517,518d415 < < 525,526d421 < < 533,534d427 < < 541,542d433 < < 547,551c438,439 < sqrt_big_int a returns the integer square root of a, that is, < the largest big integer r such that r * r <= a. Raise < Invalid_argument if a is negative. < < --- > sqrt_big_int a returns the integer square root of a, that is, the largest > big integer r such that r * r <= a. Raise Invalid_argument if a is negative. 554,555c442 < val quomod_big_int : < big_int -> big_int -> big_int * big_int --- > val quomod_big_int : big_int -> big_int -> big_int * big_int 558,563c445,448 < Euclidean division of two big integers. The first part of the < result is the quotient, the second part is the remainder. < Writing (q,r) = quomod_big_int a b, we have a = q * b + r and 0 < <= r < |b|. Raise Division_by_zero if the divisor is zero. < < --- > Euclidean division of two big integers. The first part of the result is the > quotient, the second part is the remainder. Writing (q,r) = quomod_big_int a > b, we have a = q * b + r and 0 <= r < |b|. Raise Division_by_zero if the > divisor is zero. 569,572c454,455 < Euclidean quotient of two big integers. This is the first < result q of quomod_big_int (see above). < < --- > Euclidean quotient of two big integers. This is the first result q of > quomod_big_int (see above). 578,581c461,462 < Euclidean modulus of two big integers. This is the second < result r of quomod_big_int (see above). < < --- > Euclidean modulus of two big integers. This is the second result r of > quomod_big_int (see above). 589,590d469 < < 595d473 < 600d477 < 605d481 < 607,608c483 < val power_big_int_positive_big_int : < big_int -> big_int -> big_int --- > val power_big_int_positive_big_int : big_int -> big_int -> big_int 611,615c486,489 < Exponentiation functions. Return the big integer representing < the first argument a raised to the power b (the second < argument). Depending on the function, a and b can be either < small integers or big integers. Raise Invalid_argument if b is < negative. --- > Exponentiation functions. Return the big integer representing the first > argument a raised to the power b (the second argument). Depending on the > function, a and b can be either small integers or big integers. Raise > Invalid_argument if b is negative. 622d495 < 627,630c500,501 < Return 0 if the given big integer is zero, 1 if it is < positive, and -1 if it is negative. < < --- > Return 0 if the given big integer is zero, 1 if it is positive, and -1 if > it is negative. 636,639c507,508 < compare_big_int a b returns 0 if a and b are equal, 1 if a is < greater than b, and -1 if a is smaller than b. < < --- > compare_big_int a b returns 0 if a and b are equal, 1 if a is greater than > b, and -1 if a is smaller than b. 645d513 < 650d517 < 655d521 < 660d525 < 667,668d531 < < 675,676d537 < < 683,684d543 < < 689,690c548 < Return the number of machine words used to store the given big < integer. --- > Return the number of machine words used to store the given big integer. 697d554 < 702,705c559,560 < Return the string representation of the given big integer, in < decimal (base 10). < < --- > Return the string representation of the given big integer, in decimal (base > 10). 711,713c566,567 < Convert a string to a big integer, in decimal. The string < consists of an optional - or + sign, followed by one or several < decimal digits. --- > Convert a string to a big integer, in decimal. The string consists of an > optional - or + sign, followed by one or several decimal digits. 720d573 < 727,728d579 < < 733,737c584,587 < Test whether the given big integer is small enough to be < representable as a small integer (type int) without loss of < precision. On a 32-bit platform, is_int_big_int a returns true < if and only if a is between 2^30 and 2^30-1. On a 64-bit < platform, is_int_big_int a returns true if and only if a is --- > Test whether the given big integer is small enough to be representable as a > small integer (type int) without loss of precision. On a 32-bit platform, > is_int_big_int a returns true if and only if a is between 2^30 and 2^30-1. > On a 64-bit platform, is_int_big_int a returns true if and only if a is 740,741d589 < < 746,750c594,595 < Convert a big integer to a small integer (type int). Raises < Failure "int_of_big_int" if the big integer is not < representable as a small integer. < < --- > Convert a big integer to a small integer (type int). Raises Failure > "int_of_big_int" if the big integer is not representable as a small integer. 756,758c601 < Returns a floating-point number approximating the given big < integer. < --- > Returns a floating-point number approximating the given big integer. 768d610 < 775,776d616 < < 783,784d622 < < 789,794c627,629 < Get or set the flag null_denominator. When on, attempting to < create a rational with a null denominator raises an exception. < When off, rationals with null denominators are accepted. < Initially: on. < < --- > Get or set the flag null_denominator. When on, attempting to create a > rational with a null denominator raises an exception. When off, rationals > with null denominators are accepted. Initially: on. 802,803d636 < < 808,812c641,643 < Get or set the flag normalize_ratio. When on, rational numbers < are normalized after each operation. When off, rational numbers < are not normalized until printed. Initially: off. < < --- > Get or set the flag normalize_ratio. When on, rational numbers are > normalized after each operation. When off, rational numbers are not > normalized until printed. Initially: off. 820,821d650 < < 826,831c655,657 < Get or set the flag normalize_ratio_when_printing. When on, < rational numbers are normalized before being printed. When off, < rational numbers are printed as is, without normalization. < Initially: on. < < --- > Get or set the flag normalize_ratio_when_printing. When on, rational > numbers are normalized before being printed. When off, rational numbers are > printed as is, without normalization. Initially: on. 839,840d664 < < 845,849c669,671 < Get or set the flag approx_printing. When on, rational numbers < are printed as a decimal approximation. When off, rational < numbers are printed as a fraction. Initially: off. < < --- > Get or set the flag approx_printing. When on, rational numbers are printed > as a decimal approximation. When off, rational numbers are printed as a > fraction. Initially: off. 857,858d678 < < 863,866c683,684 < Get or set the parameter floating_precision. This parameter is < the number of digits displayed when approx_printing is on. < Initially: 12. < --- > Get or set the parameter floating_precision. This parameter is the number > of digits displayed when approx_printing is on. Initially: 12. |