Annotation of OpenXM/src/asir-doc/parts/builtin/num.texi, Revision 1.8
1.8 ! noro 1: @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/num.texi,v 1.7 2002/09/03 01:50:59 noro Exp $
1.2 noro 2: \BJP
1.1 noro 3: @node $B?t$N1i;;(B,,, $BAH$_9~$_H!?t(B
4: @section $B?t$N1i;;(B
1.2 noro 5: \E
6: \BEG
7: @node Numbers,,, Built-in Function
8: @section Numbers
9: \E
1.1 noro 10:
11: @menu
12: * idiv irem::
13: * fac::
14: * igcd igcdcntl::
15: * ilcm::
16: * inv::
17: * prime lprime::
18: * random::
19: * mt_save mt_load::
20: * nm dn::
21: * conj real imag::
1.4 noro 22: * eval deval::
1.1 noro 23: * pari::
24: * setprec::
25: * setmod::
26: * lrandom::
1.3 noro 27: * ntoint32 int32ton::
1.1 noro 28: @end menu
29:
1.2 noro 30: \JP @node idiv irem,,, $B?t$N1i;;(B
31: \EG @node idiv irem,,, Numbers
1.1 noro 32: @subsection @code{idiv}, @code{irem}
33: @findex idiv
34: @findex irem
35:
36: @table @t
37: @item idiv(@var{i1},@var{i2})
1.2 noro 38: \JP :: $B@0?t=|;;$K$h$k>&(B.
39: \EG :: Integer quotient of @var{i1} divided by @var{i2}.
1.1 noro 40: @item irem(@var{i1},@var{i2})
1.2 noro 41: \JP :: $B@0?t=|;;$K$h$k>jM>(B.
42: \EG :: Integer remainder of @var{i1} divided by @var{i2}.
1.1 noro 43: @end table
44:
45: @table @var
46: @item return
1.2 noro 47: \JP $B@0?t(B
48: \EG integer
1.8 ! noro 49: @item i1 i2
1.2 noro 50: \JP $B@0?t(B
51: \EG integer
1.1 noro 52: @end table
53:
54: @itemize @bullet
1.2 noro 55: \BJP
1.1 noro 56: @item
57: @var{i1} $B$N(B @var{i2} $B$K$h$k@0?t=|;;$K$h$k>&(B, $B>jM>$r5a$a$k(B.
58: @item
59: @var{i2} $B$O(B 0 $B$G$"$C$F$O$J$i$J$$(B.
60: @item
61: $BHo=|?t$,Ii$N>l9g(B, $B@dBPCM$KBP$9$kCM$K%^%$%J%9$r$D$1$?CM$rJV$9(B.
62: @item
63: @var{i1} @code{%} @var{i2} $B$O(B, $B7k2L$,@5$K@55,2=$5$l$k$3$H$r=|$1$P(B
64: @code{irem()} $B$NBe$o$j$KMQ$$$k$3$H$,$G$-$k(B.
65: @item
66: $BB?9`<0$N>l9g$O(B @code{sdiv}, @code{srem} $B$rMQ$$$k(B.
1.2 noro 67: \E
68: \BEG
69: @item
70: Integer quotient and remainder of @var{i1} divided by @var{i2}.
71: @item
72: @var{i2} must not be 0.
73: @item
74: If the dividend is negative, the results are obtained by changing the
75: sign of the results for absolute values of the dividend.
76: @item
77: One can use
78: @var{i1} @code{%} @var{i2}
79: for replacement of @code{irem()} which only differs in the point that
80: the result is always normalized to non-negative values.
81: @item
82: Use @code{sdiv()}, @code{srem()} for polynomial quotient.
83: \E
1.1 noro 84: @end itemize
85:
86: @example
87: [0] idiv(100,7);
88: 14
89: [0] idiv(-100,7);
90: -14
91: [1] irem(100,7);
92: 2
93: [1] irem(-100,7);
94: -2
95: @end example
96:
97: @table @t
1.2 noro 98: \JP @item $B;2>H(B
99: \EG @item References
1.1 noro 100: @fref{sdiv sdivm srem sremm sqr sqrm}, @fref{%}.
101: @end table
102:
1.2 noro 103: \JP @node fac,,, $B?t$N1i;;(B
104: \EG @node fac,,, Numbers
1.1 noro 105: @subsection @code{fac}
106: @findex fac
107:
108: @table @t
109: @item fac(@var{i})
1.2 noro 110: \JP :: @var{i} $B$N3,>h(B.
111: \EG :: The factorial of @var{i}.
1.1 noro 112: @end table
113:
114: @table @var
115: @item return
1.2 noro 116: \JP $B@0?t(B
117: \EG integer
1.1 noro 118: @item i
1.2 noro 119: \JP $B@0?t(B
120: \EG integer
1.1 noro 121: @end table
122:
123: @itemize @bullet
1.2 noro 124: \BJP
1.1 noro 125: @item
126: @var{i} $B$N3,>h$r7W;;$9$k(B.
127: @item
128: @var{i} $B$,Ii$N>l9g$O(B 0 $B$rJV$9(B.
1.2 noro 129: \E
130: \BEG
131: @item
132: The factorial of @var{i}.
133: @item
134: Returns 0 if the argument @var{i} is negative.
135: \E
1.1 noro 136: @end itemize
137:
138: @example
139: [0] fac(50);
140: 30414093201713378043612608166064768844377641568960512000000000000
141: @end example
142:
1.2 noro 143: \JP @node igcd igcdcntl,,, $B?t$N1i;;(B
144: \EG @node igcd igcdcntl,,, Numbers
1.1 noro 145: @subsection @code{igcd},@code{igcdcntl}
146: @findex igcd
147: @findex igcdcntl
148:
149: @table @t
150: @item igcd(@var{i1},@var{i2})
1.2 noro 151: \JP :: $B@0?t$N(B GCD ($B:GBg8xLs?t(B)
152: \EG :: The integer greatest common divisor of @var{i1} and @var{i2}.
1.1 noro 153: @item igcdcntl([@var{i}])
1.2 noro 154: \JP :: $B@0?t(B GCD$B$N%"%k%4%j%:%`A*Br(B
155: \EG :: Selects an algorithm for integer GCD.
1.1 noro 156: @end table
157:
158: @table @var
159: @item return
1.2 noro 160: \JP $B@0?t(B
161: \EG integer
1.8 ! noro 162: @item i1 i2 i
1.2 noro 163: \JP $B@0?t(B
164: \EG integer
1.1 noro 165: @end table
166:
167: @itemize @bullet
1.2 noro 168: \BJP
1.1 noro 169: @item
170: @code{igcd} $B$O(B @var{i1} $B$H(B @var{i2} $B$N(B GCD $B$r5a$a$k(B.
171: @item
172: $B0z?t$,@0?t$G$J$$>l9g$O(B, $B%(%i!<$^$?$OL50UL#$J7k2L$rJV$9(B.
173: @item
174: $BB?9`<0$N>l9g$O(B, @code{gcd}, @code{gcdz} $B$rMQ$$$k(B.
175: @item
176: $B@0?t(B GCD $B$K$O$5$^$6$^$JJ}K!$,$"$j(B, @code{igcdcntl} $B$G@_Dj$G$-$k(B.
177:
178: @table @code
179: @item 0
180: Euclid $B8_=|K!(B (default)
181: @item 1
182: binary GCD
183: @item 2
184: bmod GCD
185: @item 3
186: accelerated integer GCD
187: @end table
1.2 noro 188: @code{2}, @code{3} $B$O(B @code{[Weber]} $B$K$h$k(B.
1.1 noro 189:
1.2 noro 190: $B$*$*$`$M(B @code{3} $B$,9bB.$@$,(B, $BNc30$b$"$k(B.
191: \E
192: \BEG
193: @item
194: Function @code{igcd()} returns the integer greatest common divisor of
195: the given two integers.
196: @item
197: An error will result if the argument is not an integer; the result is
198: not valid even if one is returned.
199: @item
200: Use @code{gcd()}, @code{gcdz()} for polynomial GCD.
201:
202: @item
203: Various method of integer GCD computation are implemented
204: and they can be selected by @code{igcdcntl}.
205:
206: @table @code
207: @item 0
208: Euclid algorithm (default)
209: @item 1
210: binary GCD
211: @item 2
212: bmod GCD
213: @item 3
214: accelerated integer GCD
215: @end table
216: @code{2}, @code{3} are due to @code{[Weber]}.
217:
218: In most cases @code{3} is the fastest, but there are exceptions.
219: \E
1.1 noro 220: @end itemize
221:
222: @example
223: [0] A=lrandom(10^4)$
224: [1] B=lrandom(10^4)$
225: [2] C=lrandom(10^4)$
226: [3] D=A*C$
227: [4] E=A*B$
228: [5] cputime(1)$
229: [6] igcd(D,E)$
230: 0.6sec + gc : 1.93sec(2.531sec)
231: [7] igcdcntl(1)$
232: [8] igcd(D,E)$
233: 0.27sec(0.2635sec)
234: [9] igcdcntl(2)$
235: [10] igcd(D,E)$
236: 0.19sec(0.1928sec)
237: [11] igcdcntl(3)$
238: [12] igcd(D,E)$
239: 0.08sec(0.08023sec)
240: @end example
241:
242: @table @t
1.2 noro 243: \JP @item $B;2>H(B
244: \EG @item References
1.1 noro 245: @fref{gcd gcdz}.
246: @end table
247:
1.2 noro 248: \JP @node ilcm,,, $B?t$N1i;;(B
249: \EG @node ilcm,,, Numbers
1.1 noro 250: @subsection @code{ilcm}
251: @findex ilcm
252:
253: @table @t
254: @item ilcm(@var{i1},@var{i2})
1.2 noro 255: \JP :: $B:G>.8xG\?t$r5a$a$k(B.
256: \EG :: The integer least common multiple of @var{i1} and @var{i2}.
1.1 noro 257: @end table
258:
259: @table @var
260: @item return
1.2 noro 261: \JP $B@0?t(B
262: \EG integer
1.8 ! noro 263: @item i1 i2
1.2 noro 264: \JP $B@0?t(B
265: \EG integer
1.1 noro 266: @end table
267:
268: @itemize @bullet
1.2 noro 269: \BJP
1.1 noro 270: @item
271: $B@0?t(B @var{i1}, @var{i2} $B$N:G>.8xG\?t$r5a$a$k(B.
272: @item
273: $B0lJ}$,(B 0 $B$N>l9g(B 0 $B$rJV$9(B.
1.2 noro 274: \E
275: \BEG
1.1 noro 276: @item
1.2 noro 277: This function computes the integer least common multiple of
278: @var{i1}, @var{i2}.
279: @item
280: If one of argument is equal to 0, the return 0.
281: \E
1.1 noro 282: @end itemize
283:
284: @table @t
1.2 noro 285: \JP @item $B;2>H(B
286: \EG @item References
1.1 noro 287: @fref{igcd igcdcntl}, @fref{mt_save mt_load}.
288: @end table
1.2 noro 289:
290: \JP @node inv,,, $B?t$N1i;;(B
291: \EG @node inv,,, Numbers
1.1 noro 292: @subsection @code{inv}
293: @findex inv
294:
295: @table @t
296: @item inv(@var{i},@var{m})
1.2 noro 297: \JP :: @var{m} $B$rK!$H$9$k(B @var{i} $B$N5U?t(B
298: \EG :: the inverse (reciprocal) of @var{i} modulo @var{m}.
1.1 noro 299: @end table
300:
301: @table @var
302: @item return
1.2 noro 303: \JP $B@0?t(B
304: \EG integer
1.8 ! noro 305: @item i m
1.2 noro 306: \JP $B@0?t(B
307: \EG integer
1.1 noro 308: @end table
309:
310: @itemize @bullet
1.2 noro 311: \BJP
1.1 noro 312: @item
313: @var{ia} @equiv{} 1 mod (@var{m}) $B$J$k@0?t(B @var{a} $B$r5a$a$k(B.
314: @item
315: @var{i} $B$H(B @var{m} $B$O8_$$$KAG$G$J$1$l$P$J$i$J$$$,(B, @code{inv()} $B$O(B
316: $B$=$N%A%'%C%/$O9T$o$J$$(B.
1.2 noro 317: \E
318: \BEG
319: @item
320: This function computes an integer such that
321: @var{ia} @equiv{} 1 mod (@var{m}).
322: @item
323: The integer @var{i} and @var{m} must be mutually prime.
324: However, @code{inv()} does not check it.
325: \E
1.1 noro 326: @end itemize
327:
328: @example
329: [71] igcd(1234,4321);
330: 1
331: [72] inv(1234,4321);
332: 3239
333: [73] irem(3239*1234,4321);
334: 1
335: @end example
336:
337: @table @t
1.2 noro 338: \JP @item $B;2>H(B
339: \EG @item References
1.1 noro 340: @fref{igcd igcdcntl}.
341: @end table
342:
1.2 noro 343: \JP @node prime lprime,,, $B?t$N1i;;(B
344: \EG @node prime lprime,,, Numbers
1.1 noro 345: @subsection @code{prime}, @code{lprime}
346: @findex prime
347: @findex lprime
348:
349: @table @t
350: @item prime(@var{index})
351: @item lprime(@var{index})
1.2 noro 352: \JP :: $BAG?t$rJV$9(B
353: \EG :: Returns a prime number.
1.1 noro 354: @end table
355:
356: @table @var
357: @item return
1.2 noro 358: \JP $B@0?t(B
359: \EG integer
1.1 noro 360: @item index
1.2 noro 361: \JP $B@0?t(B
362: \EG integer
1.1 noro 363: @end table
364:
365: @itemize @bullet
1.2 noro 366: \BJP
1.1 noro 367: @item
368: @code{prime()}, @code{lprime()} $B$$$:$l$b%7%9%F%`$,FbIt$K;}$D(B
369: $BAG?tI=$NMWAG$rJV$9(B. @code{index} $B$O(B 0 $B0J>e$N@0?t$G(B, $BAG?tI=(B
370: $B$N%$%s%G%C%/%9$KMQ$$$i$l$k(B. @code{prime()} $B$O(B 16381 $B$^$G(B
371: $B$NAG?t$r>.$5$$=g$K(B 1900 $B8D(B, @code{lprime()} $B$O(B, 10 $B?J(B 8 $B7e$G:GBg$N(B
372: $BAG?t$+$iBg$-$$=g$K(B 999 $B8DJV$9(B. $B$=$l0J30$N%$%s%G%C%/%9$KBP$7$F$O(B
373: 0 $B$rJV$9(B.
374: @item
1.2 noro 375: $B$h$j0lHLE*$JAG?t@8@.H!?t$H$7$F$O(B,
376: @code{pari(nextprime,@var{number})}
1.1 noro 377: $B$,$"$k(B.
1.2 noro 378: \E
379: \BEG
380: @item
381: The two functions, @code{prime()} and @code{lprime()}, returns
382: an element stored in the system table of prime numbers.
383: Here, @code{index} is a non-negative integer and be used as an index
384: for the prime tables.
385: The function @code{prime()} can return one of 1900 primes
386: up to 16381 indexed so that the smaller one has smaller
387: index. The function @code{lprime()} can return one of 999 primes which
388: are 8 digit sized and indexed so that the larger one has the smaller
389: index.
390: The two function always returns 0 for other indices.
391: @item
392: For more general function for prime generation, there is a @code{PARI}
393: function
394:
395: @code{pari(nextprime,@var{number})}.
396: \E
1.1 noro 397: @end itemize
398:
399: @example
400: [95] prime(0);
401: 2
402: [96] prime(1228);
403: 9973
404: [97] lprime(0);
405: 99999989
406: [98] lprime(999);
407: 0
408: @end example
409:
410: @table @t
1.2 noro 411: \JP @item $B;2>H(B
412: \EG @item References
1.1 noro 413: @fref{pari}.
414: @end table
415:
1.2 noro 416: \JP @node random,,, $B?t$N1i;;(B
417: \EG @node random,,, Numbers
1.1 noro 418: @subsection @code{random}
419: @findex random
420:
421: @table @t
1.5 takayama 422: @item random([@var{seed}])
1.2 noro 423: \JP :: $BMp?t$r@8@.$9$k(B.
1.1 noro 424: @end table
425:
426: @table @var
427: @item seed
1.2 noro 428: @itemx return
429: \JP $B<+A3?t(B
430: \EG non-negative integer
1.1 noro 431: @end table
432:
433: @itemize @bullet
1.2 noro 434: \BJP
1.1 noro 435: @item
436: $B:GBg(B 2^32-1 $B$NHsIi@0?t$NMp?t$r@8@.$9$k(B.
437: @item
438: 0 $B$G$J$$0z?t$,$"$k;~(B, $B$=$NCM$r(B seed $B$H$7$F@_Dj$7$F$+$i(B, $BMp?t$r@8@.$9$k(B.
439: @item
440: default $B$N(B seed $B$O8GDj$N$?$a(B, $B<o$r@_Dj$7$J$1$l$P(B, $B@8@.$5$l$kMp?t$N(B
441: $B7ONs$O5/F0Kh$K0lDj$G$"$k(B.
442: @item
443: $B>>K\bC(B-$B@>B<Bs;N$K$h$k(B Mersenne Twister (http://www.math.keio.ac.jp/matsumoto/mt.html) $B%"%k%4%j%:%`$N(B, $BH`$i<+?H$K$h$k<BAu$rMQ$$$F$$$k(B.
444: @item
445: $B<~4|$O(B 2^19937-1 $B$HHs>o$KD9$$(B.
446: @item
447: @code{mt_save} $B$K$h$j(B state $B$r%U%!%$%k$K(B save $B$G$-$k(B. $B$3$l$r(B @code{mt_load}
448: $B$GFI$_9~$`$3$H$K$h$j(B, $B0[$k(B Asir $B%;%C%7%g%s4V$G0l$D$NMp?t$N7ONs$rC)$k$3$H$,(B
449: $B$G$-$k(B.
1.2 noro 450: \E
451: \BEG
452: @item
453: Generates a random number which is a non-negative integer less than 2^32.
454: @item
455: If a non zero argument is specified, then after setting it as a random seed,
456: a random number is generated.
457: @item
458: As the default seed is fixed, the sequence of the random numbers is
459: always the same if a seed is not set.
460: @item
461: The algorithm is Mersenne Twister
462: (http://www.math.keio.ac.jp/matsumoto/mt.html) by M. Matsumoto and
463: T. Nishimura. The implementation is done also by themselves.
464: @item
465: The period of the random number sequence is 2^19937-1.
466: @item
467: One can save the state of the random number generator with @code{mt_save}.
468: By loading the state file with @code{mt_load},
469: one can trace a single random number sequence arcoss multiple sessions.
470: \E
1.1 noro 471: @end itemize
472:
473: @table @t
1.2 noro 474: \JP @item $B;2>H(B
475: \EG @item References
1.1 noro 476: @fref{lrandom}, @fref{mt_save mt_load}.
477: @end table
478:
1.2 noro 479: \JP @node lrandom,,, $B?t$N1i;;(B
480: \EG @node lrandom,,, Numbers
1.1 noro 481: @subsection @code{lrandom}
482: @findex lrandom
483:
484: @table @t
1.5 takayama 485: @item lrandom(@var{bit})
1.2 noro 486: \JP :: $BB?G\D9Mp?t$r@8@.$9$k(B.
487: \EG :: Generates a long random number.
1.1 noro 488: @end table
489:
490: @table @var
491: @item bit
492: @item return
1.2 noro 493: \JP $B<+A3?t(B
494: \EG integer
1.1 noro 495: @end table
496:
497: @itemize @bullet
1.2 noro 498: \BJP
1.1 noro 499: @item
500: $B9b!9(B @var{bit} $B$NHsIi@0?t$NMp?t$r@8@.$9$k(B.
501: @item
502: @code{random} $B$rJ#?t2s8F$S=P$7$F7k9g$7(B, $B;XDj$N(B bit $BD9$K%^%9%/$7$F$$$k(B.
1.2 noro 503: \E
504: \BEG
505: @item
506: Generates a non-negative integer of at most @var{bit} bits.
507: @item
508: The result is a concatination of outputs of @code{random}.
509: \E
1.1 noro 510: @end itemize
511:
512: @table @t
1.2 noro 513: \JP @item $B;2>H(B
514: \EG @item References
1.1 noro 515: @fref{random}, @fref{mt_save mt_load}.
516: @end table
517:
1.2 noro 518: \JP @node mt_save mt_load,,, $B?t$N1i;;(B
519: \EG @node mt_save mt_load,,, Numbers
1.1 noro 520: @subsection @code{mt_save}, @code{mt_load}
521: @findex mt_save
522: @findex mt_load
523:
524: @table @t
525: @item mt_save(@var{fname})
1.2 noro 526: \JP :: $BMp?t@8@.4o$N8=:_$N>uBV$r%U%!%$%k$K%;!<%V$9$k(B.
527: \EG :: Saves the state of the random number generator.
1.1 noro 528: @item mt_load(@var{fname})
1.2 noro 529: \JP :: $B%U%!%$%k$K%;!<%V$5$l$?Mp?t@8@.4o$N>uBV$r%m!<%I$9$k(B.
530: \EG :: Loads a saved state of the random number generator.
1.1 noro 531: @end table
532:
533: @table @var
534: @item return
1.2 noro 535: \JP 0 $B$^$?$O(B 1
536: \EG 0 or 1
1.1 noro 537: @item fname
1.2 noro 538: \JP $BJ8;zNs(B
539: \EG string
1.1 noro 540: @end table
541:
542: @itemize @bullet
1.2 noro 543: \BJP
544: @item
545: $B$"$k>uBV$r%;!<%V$7(B, $B$=$N>uBV$r%m!<%I$9$k$3$H$G(B,
1.1 noro 546: $B0l$D$N5?;wMp?t7ONs$r(B, $B?75,$N(B Asir $B%;%C%7%g%s$GB3$1$F$?$I$k$3$H$,(B
547: $B$G$-$k(B.
1.2 noro 548: \E
549: \BEG
550: @item
551: One can save the state of the random number generator with @code{mt_save}.
552: By loading the state file with @code{mt_load},
553: one can trace a single random number sequence arcoss multiple
554: @b{Asir} sessions.
555: \E
1.1 noro 556: @end itemize
557:
558: @example
559: [340] random();
560: 3510405877
561: [341] mt_save("/tmp/mt_state");
562: 1
563: [342] random();
564: 4290933890
565: [343] quit;
566: % asir
567: This is Asir, Version 991108.
568: Copyright (C) FUJITSU LABORATORIES LIMITED.
569: 3 March 1994. All rights reserved.
570: [340] mt_load("/tmp/mt_state");
571: 1
572: [341] random();
573: 4290933890
574: @end example
575:
576: @table @t
1.2 noro 577: \JP @item $B;2>H(B
578: \EG @item References
1.1 noro 579: @fref{random}, @fref{lrandom}.
580: @end table
581:
1.2 noro 582: \JP @node nm dn,,, $B?t$N1i;;(B
583: \EG @node nm dn,,, Numbers
1.1 noro 584: @subsection @code{nm}, @code{dn}
585: @findex nm
586: @findex dn
587:
588: @table @t
589: @item nm(@var{rat})
1.2 noro 590: \JP :: @var{rat} $B$NJ,;R(B.
591: \EG :: Numerator of @var{rat}.
1.1 noro 592: @item dn(@var{rat})
1.2 noro 593: \JP :: @var{rat} $B$NJ,Jl(B.
594: \EG :: Denominator of @var{rat}.
1.1 noro 595: @end table
596:
597: @table @var
598: @item return
1.2 noro 599: \JP $B@0?t$^$?$OB?9`<0(B
600: \EG integer or polynomial
1.1 noro 601: @item rat
1.2 noro 602: \JP $BM-M}?t$^$?$OM-M}<0(B
603: \EG rational number or rational expression
1.1 noro 604: @end table
605:
606: @itemize @bullet
1.2 noro 607: \BJP
1.1 noro 608: @item
609: $BM?$($i$l$?M-M}?t$^$?M-M}<0$NJ,;R5Z$SJ,Jl$rJV$9(B.
610: @item
611: $BM-M}?t$N>l9g(B, $BJ,Jl$O>o$K@5$G(B, $BId9f$OJ,;R$,;}$D(B.
612: @item
613: $BM-M}<0$N>l9g(B, $BC1$KJ,Jl(B, $BJ,;R$r<h$j=P$9$@$1$G$"$k(B.
614: $BM-M}<0$KBP$7$F$O(B, $BLsJ,$O<+F0E*$K$O9T$o$l$J$$(B. @code{red()}
615: $B$rL@<(E*$K8F$S=P$9I,MW$,$"$k(B.
1.2 noro 616: \E
617: \BEG
618: @item
619: Numerator and denominator of a given rational expression.
620: @item
621: For a rational number, they return its numerator and denominator,
622: respectively. For a rational expression whose numerator and denominator
623: may contain rational numbers, they do not separate those rational
624: coefficients to numerators and denominators.
625: @item
626: For a rational number, the denominator is always kept positive, and
627: the sign is contained in the numerator.
628: @item
629: @b{Risa/Asir} does not cancel the common divisors unless otherwise explicitly
630: specified by the user.
631: Therefore, @code{nm()} and @code{dn()} return the numerator and the
632: denominator as it is, respectively.
633: \E
1.1 noro 634: @end itemize
635:
636: @example
637: [2] [nm(-43/8),dn(-43/8)];
638: [-43,8]
639: [3] dn((x*z)/(x*y));
640: y*x
641: [3] dn(red((x*z)/(x*y)));
642: y
643: @end example
644:
645: @table @t
1.2 noro 646: \JP @item $B;2>H(B
647: \EG @item References
1.1 noro 648: @fref{red}.
649: @end table
650:
1.2 noro 651: \JP @node conj real imag,,, $B?t$N1i;;(B
652: \EG @node conj real imag,,, Numbers
1.1 noro 653: @subsection @code{conj}, @code{real}, @code{imag}
654: @findex conj
655:
656: @table @t
657: @item real(@var{comp})
1.2 noro 658: \JP :: @var{comp} $B$N<B?tItJ,(B.
659: \EG :: Real part of @var{comp}.
1.1 noro 660: @item imag(@var{comp})
1.2 noro 661: \JP :: @var{comp} $B$N5u?tItJ,(B.
662: \EG :: Imaginary part of @var{comp}.
1.1 noro 663: @item conj(@var{comp})
1.2 noro 664: \JP :: @var{comp} $B$N6&LrJ#AG?t(B.
665: \EG :: Complex conjugate of @var{comp}.
1.1 noro 666: @end table
667:
668: @table @var
669: @item return comp
1.2 noro 670: \JP $BJ#AG?t(B
671: \EG complex number
1.1 noro 672: @end table
673:
674: @itemize @bullet
1.2 noro 675: \BJP
1.1 noro 676: @item
677: $BJ#AG?t$KBP$7(B, $B<BIt(B, $B5uIt(B, $B6&Lr$r5a$a$k(B.
678: @item
679: $B$3$l$i$O(B, $BB?9`<0$KBP$7$F$bF/$/(B.
1.2 noro 680: \E
681: \BEG
682: @item
683: Basic operations for complex numbers.
684: @item
685: These functions works also for polynomials with complex coefficients.
686: \E
1.1 noro 687: @end itemize
688:
689: @example
690: [111] A=(2+@@i)^3;
691: (2+11*@@i)
692: [112] [real(A),imag(A),conj(A)];
693: [2,11,(2-11*@@i)]
694: @end example
695:
1.4 noro 696: \JP @node eval deval ,,, $B?t$N1i;;(B
697: \EG @node eval deval,,, Numbers
698: @subsection @code{eval}, @code{deval}
1.1 noro 699: @findex eval
1.4 noro 700: @findex deval
1.1 noro 701: @cindex PARI
702:
703: @table @t
704: @item eval(@var{obj}[,@var{prec}])
1.4 noro 705: @item deval(@var{obj})
1.2 noro 706: \JP :: @var{obj} $B$NCM$NI>2A(B.
707: \EG :: Evaluate @var{obj} numerically.
1.1 noro 708: @end table
709:
710: @table @var
711: @item return
1.2 noro 712: \JP $B?t$"$k$$$O<0(B
713: \EG number or expression
1.1 noro 714: @item obj
1.2 noro 715: \JP $B0lHL$N<0(B
716: \EG general expression
1.1 noro 717: @item prec
1.2 noro 718: \JP $B@0?t(B
719: \EG integer
1.1 noro 720: @end table
721:
722: @itemize @bullet
1.2 noro 723: \BJP
1.1 noro 724: @item
725: @var{obj} $B$K4^$^$l$kH!?t$NCM$r2DG=$J8B$jI>2A$9$k(B.
726: @item
1.4 noro 727: @code{deval} $B$OG\@:EYIbF0>.?t$r7k2L$H$7$F(B
728: @code{eval} $B$N>l9g(B, $BM-M}?t$O$=$N$^$^;D$k(B.
1.1 noro 729: @item
1.7 noro 730: @code{eval} $B$K$*$$$F$O(B, $B7W;;$O(B @b{PARI} (@ref{pari}) $B$,9T$&(B.
1.4 noro 731: @code{deval} $B$K$*$$$F$O(B, $B7W;;$O(B C $B?t3X%i%$%V%i%j$N4X?t$rMQ$$$F9T$&(B.
732: @item
733: @code{deval} $B$OJ#AG?t$O07$($J$$(B.
734: @item
735: @code{eval} $B$K$*$$$F$O(B,
1.1 noro 736: @var{prec} $B$r;XDj$7$?>l9g(B, $B7W;;$O(B, 10 $B?J(B @var{prec} $B7eDxEY$G9T$o$l$k(B.
737: @var{prec} $B$N;XDj$,$J$$>l9g(B, $B8=:_@_Dj$5$l$F$$$k@:EY$G9T$o$l$k(B.
1.7 noro 738: (@xref{setprec}.)
1.1 noro 739: @item
740: @table @t
741: @item $B07$($kH!?t$O(B, $B<!$NDL$j(B.
742: @code{sin}, @code{cos}, @code{tan},
743:
744: @code{asin}, @code{acos}, @code{atan},
745:
746: @code{sinh}, @code{cosh}, @code{tanh},
747:
748: @code{asinh}, @code{acosh}, @code{atanh},
749:
750: @code{exp}, @code{log}, @code{pow(a,b) (a^b)}
751: @end table
752: @item
1.4 noro 753: $B0J2<$N5-9f$r?t$H$7$FI>2A$G$-$k(B. $B$?$@$7(B @code{@@i} $B$r07$($k$N$O(B
754: @code{eval}, @code{deval} $B$N$_$G$"$k(B.
1.1 noro 755: @table @t
756: @item @@i
757: $B5u?tC10L(B
758: @item @@pi
759: $B1_<~N((B
760: @item @@e
761: $B<+A3BP?t$NDl(B
762: @end table
1.2 noro 763: \E
764: \BEG
765: @item
766: Evaluates the value of the functions contained in @var{obj} as far as
767: possible.
768: @item
1.4 noro 769: @code{deval} returns
770: double float. Rational numbers remain unchanged in results from @code{eval}.
771: @item
772: In @code{eval} the computation is done
1.7 noro 773: by @b{PARI}. (@xref{pari}.) In @code{deval} the computation is
1.4 noro 774: done by the C math library.
775: @item
776: @code{deval} cannot handle complex numbers.
1.2 noro 777: @item
778: When @var{prec} is specified, computation will be performed with a
779: precision of about @var{prec}-digits.
780: If @var{prec} is not specified, computation is performed with the
1.7 noro 781: precision set currently. (@xref{setprec}.)
1.2 noro 782: @item
783: Currently available numerical functions are listed below.
784: Note they are only a small part of whole @b{PARI} functions.
785:
786: @table @t
787: @code{sin}, @code{cos}, @code{tan},
788:
789: @code{asin}, @code{acos}, @code{atan},
790:
791: @code{sinh}, @code{cosh}, @code{tanh},
792: @code{asinh}, @code{acosh}, @code{atanh},
793:
794: @code{exp}, @code{log}, @code{pow(a,b) (a^b)}
795: @end table
796: @item
1.4 noro 797: Symbols for special values are as the followings. Note that
798: @code{@@i} cannot be handled by @code{deval}.
1.2 noro 799: @table @t
800: @item @@i
801: unit of imaginary number
802: @item @@pi
803: the number pi,
804: the ratio of circumference to diameter
805: @item @@e
806: Napier's number (@t{exp}(1))
807: @end table
808: \E
1.1 noro 809: @end itemize
810:
811: @example
812: [118] eval(exp(@@pi*@@i));
813: -1.0000000000000000000000000000
814: [119] eval(2^(1/2));
815: 1.414213562373095048763788073031
816: [120] eval(sin(@@pi/3));
817: 0.86602540378443864674620506632
818: [121] eval(sin(@@pi/3)-3^(1/2)/2,50);
819: -2.78791084448179148471 E-58
1.4 noro 820: [122] eval(1/2);
821: 1/2
822: [123] deval(sin(1)^2+cos(1)^2);
823: 1
1.1 noro 824: @end example
825:
826: @table @t
1.2 noro 827: \JP @item $B;2>H(B
828: \EG @item References
1.1 noro 829: @fref{ctrl}, @fref{setprec}, @fref{pari}.
830: @end table
831:
1.2 noro 832: \JP @node pari,,, $B?t$N1i;;(B
833: \EG @node pari,,, Numbers
1.1 noro 834: @subsection @code{pari}
835: @findex pari
836: @cindex PARI
837:
838: @table @t
839: @item pari(@var{func},@var{arg},@var{prec})
1.2 noro 840: \JP :: @b{PARI} $B$NH!?t(B @var{func} $B$r8F$S=P$9(B.
841: \EG :: Call @b{PARI} function @var{func}.
1.1 noro 842: @end table
843:
844: @table @var
845: @item return
1.2 noro 846: \JP @var{func} $BKh$K0[$J$k(B.
847: \EG Depends on @var{func}.
1.1 noro 848: @item func
1.2 noro 849: \JP @b{PARI} $B$NH!?tL>(B
850: \EG Function name of @b{PARI}.
1.1 noro 851: @item arg
1.2 noro 852: \JP @var{func} $B$N0z?t(B
853: \EG Arguments of @var{func}.
1.1 noro 854: @item prec
1.2 noro 855: \JP $B@0?t(B
856: \EG integer
1.1 noro 857: @end table
858:
859: @itemize @bullet
1.2 noro 860: \BJP
1.1 noro 861: @item
862: @b{PARI} $B$NH!?t$r8F$S=P$9(B.
863:
864: @item
865: @b{PARI} @code{[Batut et al.]} $B$O(B Bordeaux $BBg3X$G3+H/$5$l%U(B
866: $B%j!<%=%U%H%&%'%"$H$7$F8x3+$5$l$F$$$k(B. @b{PARI} $B$O?t<0=hM}E*$J5!G=$rM-(B
867: $B$7$F$O$$$k$,(B, $B<g$J%?!<%2%C%H$O@0?tO@$K4XO"$7$??t(B (@b{bignum},
868: @b{bigfloat}) $B$N1i;;$G(B, $B;MB'1i;;$K8B$i$:(B@b{bigfloat} $B$K$h$k$5$^$6$^$J(B
869: $BH!?tCM$NI>2A$r9bB.$K9T$&$3$H$,$G$-$k(B. @b{PARI} $B$OB>$N%W%m%0%i%`$+$i(B
870: $B%5%V%k!<%A%s%i%$%V%i%j$H$7$FMQ$$$k$3$H$,$G$-(B, $B$^$?(B, @samp{gp} $B$H$$$&(B
871: @b{PARI}$B%i%$%V%i%j$N%$%s%?%U%'!<%9$K$h$j(B UNIX $B$N%"%W%j%1!<%7%g%s$H$7$F(B
1.2 noro 872: $BMxMQ$9$k$3$H$b$G$-$k(B. $B8=:_$N%P!<%8%g%s$O(B @b{2.0.17beta} $B$G$$$/$D$+$N(B ftp
873: site ($B$?$H$($P(B @code{ftp://megrez.ceremab.u-bordeaux.fr/pub/pari})
1.1 noro 874: $B$+$i(B anonymous ftp $B$G$-$k(B.
875: @item
876: $B:G8e$N0z?t(B @var{prec} $B$G7W;;@:EY$r;XDj$G$-$k(B.
877: @var{prec} $B$r>JN,$7$?>l9g(B @code{setprec()} $B$G;XDj$7$?@:EY$H$J$k(B.
878: @item
879: $B8=;~E@$G<B9T$G$-$k(B @b{PARI} $B$NH!?t$O<!$NDL$j$G$"$k(B. $B$$$:$l$b(B
880: 1 $B0z?t$G(B @b{Asir} $B$,BP1~$G$-$k7?$N0z?t$r$H$kH!?t$G$"$k(B.
881: $B$J$*3F!9$N5!G=$K$D$$$F$O(B @b{PARI} $B$N%^%K%e%"%k$r;2>H$N$3$H(B.
1.2 noro 882: \E
883: \BEG
884: @item
885: This command connects @b{Asir} to @b{PARI} system so that several
886: functions of @b{PARI} can be conveniently used from @b{Risa/Asir}.
887: @item
888: @b{PARI} @code{[Batut et al.]} is developed at Bordeaux University, and
889: distributed as a free software. Though it has a certain facility to computer
890: algebra, its major target is the operation of numbers (@b{bignum},
891: @b{bigfloat}) related to the number theory. It facilitates various
892: function evaluations as well as arithmetic operations at a remarkable
893: speed. It can also be used from other external programs as a library.
894: It provides a language interface named @samp{gp} to its library, which
895: enables a user to use @b{PARI} as a calculator which runs on UNIX.
896: The current version is @b{2.0.17beta}. It can be obtained by several ftp
897: sites. (For example, @code{ftp://megrez.ceremab.u-bordeaux.fr/pub/pari}.)
898: @item
899: The last argument (optional) @var{int} specifies the precision in digits
900: for bigfloat operation.
901: If the precision is not explicitly specified, operation will be performed
902: with the precision set by @code{setprec()}.
903: @item
904: Currently available functions of @b{PARI} system are as follows.
905: Note these are only a part of functions in @b{PARI} system.
906: For details of individual functions, refer to the @b{PARI} manual.
907: (Some of them can be seen in the following example.)
908: \E
1.1 noro 909:
910: @code{abs},
911: @code{adj},
912: @code{arg},
913: @code{bigomega},
914: @code{binary},
915: @code{ceil},
916: @code{centerlift},
917: @code{cf},
918: @code{classno},
919: @code{classno2},
920: @code{conj},
921: @code{content},
922: @code{denom},
923: @code{det},
924: @code{det2},
925: @code{detr},
926: @code{dilog},
927: @code{disc},
928: @code{discf},
929: @code{divisors},
930: @code{eigen},
931: @code{eintg1},
932: @code{erfc},
933: @code{eta},
934: @code{floor},
935: @code{frac},
936: @code{galois},
937: @code{galoisconj},
938: @code{gamh},
939: @code{gamma},
940: @code{hclassno},
941: @code{hermite},
942: @code{hess},
943: @code{imag},
944: @code{image},
945: @code{image2},
946: @code{indexrank},
947: @code{indsort},
948: @code{initalg},
949: @code{isfund},
950: @code{isprime},
951: @code{ispsp},
952: @code{isqrt},
953: @code{issqfree},
954: @code{issquare},
955: @code{jacobi},
956: @code{jell},
957: @code{ker},
958: @code{keri},
959: @code{kerint},
960: @code{kerintg1},
961: @code{kerint2},
962: @code{kerr},
963: @code{length},
964: @code{lexsort},
965: @code{lift},
966: @code{lindep},
967: @code{lll},
968: @code{lllg1},
969: @code{lllgen},
970: @code{lllgram},
971: @code{lllgramg1},
972: @code{lllgramgen},
973: @code{lllgramint},
974: @code{lllgramkerim},
975: @iftex
976: @break
977: @end iftex
978: @code{lllgramkerimgen},
979: @code{lllint},
980: @code{lllkerim},
981: @code{lllkerimgen},
982: @code{lllrat},
983: @code{lngamma},
984: @code{logagm},
985: @code{mat},
986: @code{matrixqz2},
987: @code{matrixqz3},
988: @code{matsize},
989: @code{modreverse},
990: @code{mu},
991: @code{nextprime},
992: @code{norm},
993: @code{norml2},
994: @code{numdiv},
995: @code{numer},
996: @code{omega},
997: @code{order},
998: @code{ordred},
999: @code{phi},
1000: @code{pnqn},
1001: @code{polred},
1002: @code{polred2},
1003: @code{primroot},
1004: @code{psi},
1005: @code{quadgen},
1006: @code{quadpoly},
1007: @code{real},
1008: @code{recip},
1009: @code{redcomp},
1010: @code{redreal},
1011: @code{regula},
1012: @code{reorder},
1013: @code{reverse},
1014: @code{rhoreal},
1015: @code{roots},
1016: @code{rootslong},
1017: @code{round},
1018: @code{sigma},
1019: @code{signat},
1020: @code{simplify},
1021: @code{smalldiscf},
1022: @code{smallfact},
1023: @code{smallpolred},
1024: @code{smallpolred2},
1025: @code{smith},
1026: @code{smith2},
1027: @code{sort},
1028: @code{sqr},
1029: @code{sqred},
1030: @code{sqrt},
1031: @code{supplement},
1032: @code{trace},
1033: @code{trans},
1034: @code{trunc},
1035: @code{type},
1036: @code{unit},
1037: @code{vec},
1038: @code{wf},
1039: @code{wf2},
1040: @code{zeta}
1041:
1.2 noro 1042: \BJP
1.1 noro 1043: @item
1044: @b{Asir} $B$GMQ$$$F$$$k$N$O(B @b{PARI} $B$N$[$s$N0lIt$N5!G=$G$"$k$,(B, $B:#8e(B
1045: $B$h$jB?$/$N5!G=$,MxMQ$G$-$k$h$&2~NI$9$kM=Dj$G$"$k(B.
1.2 noro 1046: \E
1047: \BEG
1048: @item
1049: @b{Asir} currently uses only a very small subset of @b{PARI}.
1050: We will improve @b{Asir} so that it can provide more functions of
1051: @b{PARI}.
1052: \E
1.1 noro 1053: @end itemize
1054:
1055: @example
1.2 noro 1056: \JP /* $B9TNs$N8GM-%Y%/%H%k$r5a$a$k(B. */
1057: \EG /* Eigen vectors of a numerical matrix */
1.1 noro 1058: [0] pari(eigen,newmat(2,2,[[1,1],[1,2]]));
1059: [ -1.61803398874989484819771921990 0.61803398874989484826 ]
1060: [ 1 1 ]
1.2 noro 1061: \JP /* 1 $BJQ?tB?9`<0$N:,$r5a$a$k(B. */
1062: \EG /* Roots of a polynomial */
1.1 noro 1063: [1] pari(roots,t^2-2);
1064: [ -1.41421356237309504876 1.41421356237309504876 ]
1065: @end example
1066:
1067: @table @t
1.2 noro 1068: \JP @item $B;2>H(B
1069: \EG @item References
1.1 noro 1070: @fref{setprec}.
1071: @end table
1072:
1.2 noro 1073: \JP @node setprec,,, $B?t$N1i;;(B
1074: \EG @node setprec,,, Numbers
1.1 noro 1075: @subsection @code{setprec}
1076: @findex setprec
1077: @cindex PARI
1078:
1079: @table @t
1080: @item setprec([@var{n}])
1.2 noro 1081: \JP :: @b{bigfloat} $B$N7e?t$r(B @var{n} $B7e$K@_Dj$9$k(B.
1082: \EG :: Sets the precision for @b{bigfloat} operations to @var{n} digits.
1.1 noro 1083: @end table
1084:
1085: @table @var
1086: @item return
1.2 noro 1087: \JP $B@0?t(B
1088: \EG integer
1.1 noro 1089: @item n
1.2 noro 1090: \JP $B@0?t(B
1091: \EG integer
1.1 noro 1092: @end table
1093:
1094: @itemize @bullet
1.2 noro 1095: \BJP
1.1 noro 1096: @item
1097: $B0z?t$,$"$k>l9g(B, @b{bigfloat} $B$N7e?t$r(B @var{n} $B7e$K@_Dj$9$k(B.
1098: $B0z?t$N$"$k$J$7$K$+$+$o$i$:(B, $B0JA0$K@_Dj$5$l$F$$$?CM$rJV$9(B.
1099: @item
1.7 noro 1100: @b{bigfloat} $B$N7W;;$O(B @b{PARI} (@ref{pari}) $B$K$h$C$F9T$o$l$k(B.
1.1 noro 1101: @item
1102: @b{bigfloat} $B$G$N7W;;$KBP$7M-8z$G$"$k(B.
1103: @b{bigfloat} $B$N(B flag $B$r(B on $B$K$9$kJ}K!$O(B, @code{ctrl} $B$r;2>H(B.
1104: @item
1105: $B@_Dj$G$-$k7e?t$K>e8B$O$J$$$,(B, $B;XDj$7$?7e?t$K@_Dj$5$l$k$H$O(B
1106: $B8B$i$J$$(B. $BBg$-$a$NCM$r@_Dj$9$k$N$,0BA4$G$"$k(B.
1.2 noro 1107: \E
1108: \BEG
1109: @item
1110: When an argument is given, it
1111: sets the precision for @b{bigfloat} operations to @var{n} digits.
1112: The return value is always the previous precision in digits regardless of
1113: the existence of an argument.
1114:
1115: @item
1.7 noro 1116: @b{Bigfloat} operations are done by @b{PARI}. (@xref{pari}.)
1.2 noro 1117: @item
1118: This is effective for computations in @b{bigfloat}.
1119: Refer to @code{ctrl()} for turning on the `@b{bigfloat} flag.'
1120: @item
1121: There is no upper limit for precision digits.
1122: It sets the precision to some digits around the specified precision.
1123: Therefore, it is safe to specify a larger value.
1124: \E
1.1 noro 1125: @end itemize
1126:
1127: @example
1128: [1] setprec();
1129: 9
1130: [2] setprec(100);
1131: 9
1132: [3] setprec(100);
1133: 96
1134: @end example
1135:
1136: @table @t
1.2 noro 1137: \JP @item $B;2>H(B
1.4 noro 1138: @fref{ctrl}, @fref{eval deval}, @fref{pari}.
1.1 noro 1139: @end table
1140:
1.2 noro 1141: \JP @node setmod,,, $B?t$N1i;;(B
1142: \EG @node setmod,,, Numbers
1.1 noro 1143: @subsection @code{setmod}
1144: @findex setmod
1145:
1146: @table @t
1147: @item setmod([@var{p}])
1.2 noro 1148: \JP :: $BM-8BBN$r(B GF(@var{p}) $B$K@_Dj$9$k(B.
1149: \EG :: Sets the ground field to GF(@var{p}).
1.1 noro 1150: @end table
1151:
1152: @table @var
1153: @item return
1.2 noro 1154: \JP $B@0?t(B
1155: \EG integer
1.1 noro 1156: @item n
1.2 noro 1157: \JP 2^27 $BL$K~$NAG?t(B
1158: \EG prime less than 2^27
1.1 noro 1159: @end table
1160:
1161: @itemize @bullet
1.2 noro 1162: \BJP
1.1 noro 1163: @item
1164: $BM-8BBN$r(B GF(@var{p}) $B$K@_Dj$9$k(B. $B@_DjCM$rJV$9(B.
1165: @item
1166: $BM-8BBN$N85$N7?$r;}$D?t$O(B, $B$=$l<+?H$O$I$NM-8BBN$KB0$9$k$+$N>pJs$r;}$?$:(B,
1167: $B8=:_@_Dj$5$l$F$$$kAG?t(B @var{p} $B$K$h$j(B GF(@var{p}) $B>e$G$N1i;;$,E,MQ$5$l$k(B.
1.2 noro 1168: @item
1169: $B0L?t$NBg$-$JM-8BBN$K4X$7$F$O(B @pxref{$BM-8BBN$K4X$9$k1i;;(B}.
1170: \E
1171: \BEG
1172: @item
1173: Sets the ground field to GF(@var{p}) and returns the value @var{p}.
1174: @item
1175: A member of a finite field does not have any information
1176: about the field and the arithmetic operations over GF(@var{p}) are applied
1177: with @var{p} set at the time.
1178: @item
1179: As for large finite fields, @pxref{Finite fields}.
1180: \E
1.1 noro 1181: @end itemize
1182:
1183: @example
1184: [0] A=dp_mod(dp_ptod(2*x,[x]),3,[]);
1185: (2)*<<1>>
1186: [1] A+A;
1187: addmi : invalid modulus
1188: return to toplevel
1189: [1] setmod(3);
1190: 3
1191: [2] A+A;
1192: (1)*<<1>>
1193: @end example
1194:
1195: @table @t
1.2 noro 1196: \JP @item $B;2>H(B
1197: \EG @item References
1198: \JP @fref{dp_mod dp_rat}, @fref{$B?t$N7?(B}.
1199: \EG @fref{dp_mod dp_rat}, @fref{Types of numbers}.
1.1 noro 1200: @end table
1201:
1.3 noro 1202: \JP @node ntoint32 int32ton,,, $B?t$N1i;;(B
1203: \EG @node ntoint32 int32ton,,, Numbers
1204: @subsection @code{ntoint32}, @code{int32ton}
1205: @findex ntoint32
1206: @findex int32ton
1207:
1208: @table @t
1209: @item ntoint32(@var{n})
1210: @itemx int32ton(@var{int32})
1211: \JP :: $BHsIi@0?t$HId9f$J$7(B 32bit $B@0?t$N4V$N7?JQ49(B.
1212: \EG :: Type-conversion between a non-negative integer and an unsigned 32bit integer.
1213: @end table
1214:
1215: @table @var
1216: @item return
1217: \JP $BId9f$J$7(B 32bit $B@0?t$^$?$OHsIi@0?t(B
1218: \EG unsigned 32bit integer or non-negative integer
1219: @item n
1220: \JP 2^32 $BL$K~$NHsIi@0?t(B
1221: \EG non-negative interger less than 2^32
1222: @item int32
1223: \JP $BId9f$J$7(B 32bit $B@0?t(B
1224: \EG unsigned 32bit integer
1225: @end table
1226:
1227: @itemize @bullet
1228: \BJP
1229: @item $BHsIi@0?t(B ($B<1JL;R(B 1) $B$NId9f$J$7(B 32bit $B@0?t(B ($B<1JL;R(B 10) $B$X$NJQ49(B,
1230: $B$^$?$O$=$N5UJQ49$r9T$&(B.
1231: @item 32bit $B@0?t$O(B @b{OpenXM} $B$N4pK\9=@.MWAG$G$"$j(B, $B@0?t$r$=$N7?$GAw?.(B
1232: $B$9$kI,MW$,$"$k>l9g$KMQ$$$k(B.
1233: \E
1234: \BEG
1235: @item These functions do conversions between non-negative
1236: integers (the type id 1) and unsigned 32bit integers (the type id 10).
1237: @item An unsigned 32bit integer is a fundamental construct of @b{OpenXM}
1238: and one often has to send an integer to a server as an unsigned 32bit
1239: integer. These functions are used in such a case.
1240: \E
1241: @end itemize
1242:
1243: @table @t
1244: \JP @item $B;2>H(B
1245: \EG @item References
1246: \JP @fref{$BJ,;67W;;(B}, @fref{$B?t$N7?(B}.
1247: \EG @fref{Distributed computation}, @fref{Types of numbers}.
1248: @end table
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>