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