[BACK]Return to num.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts / builtin

Diff for /OpenXM/src/asir-doc/parts/builtin/num.texi between version 1.2 and 1.13

version 1.2, 1999/12/21 02:47:34 version 1.13, 2019/03/29 01:57:46
Line 1 
Line 1 
 @comment $OpenXM$  @comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/num.texi,v 1.12 2016/08/29 04:56:58 noro Exp $
 \BJP  \BJP
 @node $B?t$N1i;;(B,,, $BAH$_9~$_H!?t(B  @node $B?t$N1i;;(B,,, $BAH$_9~$_H!?t(B
 @section $B?t$N1i;;(B  @section $B?t$N1i;;(B
Line 13 
Line 13 
 * fac::  * fac::
 * igcd igcdcntl::  * igcd igcdcntl::
 * ilcm::  * ilcm::
   * isqrt::
 * inv::  * inv::
 * prime lprime::  * prime lprime::
 * random::  * random::
 * mt_save mt_load::  * mt_save mt_load::
 * nm dn::  * nm dn::
 * conj real imag::  * conj real imag::
 * eval::  * eval deval::
 * pari::  * pari::
 * setprec::  * setbprec setprec::
 * setmod::  * setmod::
 * lrandom::  * lrandom::
   * ntoint32 int32ton::
   * setround::
   * inttorat::
 @end menu  @end menu
   
 \JP @node idiv irem,,, $B?t$N1i;;(B  \JP @node idiv irem,,, $B?t$N1i;;(B
Line 45 
Line 49 
 @item return  @item return
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @item i1,i2  @item i1 i2
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @end table  @end table
Line 158  Returns 0 if the argument @var{i} is negative.
Line 162  Returns 0 if the argument @var{i} is negative.
 @item return  @item return
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @item i1,i2,i  @item i1 i2 i
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @end table  @end table
Line 259  In most cases @code{3} is the fastest, but there are e
Line 263  In most cases @code{3} is the fastest, but there are e
 @item return  @item return
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @item i1,i2  @item i1 i2
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @end table  @end table
Line 286  If one of argument is equal to 0, the return 0.
Line 290  If one of argument is equal to 0, the return 0.
 @fref{igcd igcdcntl}, @fref{mt_save mt_load}.  @fref{igcd igcdcntl}, @fref{mt_save mt_load}.
 @end table  @end table
   
   \JP @node isqrt,,, $B?t$N1i;;(B
   \EG @node isqrt,,, Numbers
   @subsection @code{isqrt}
   @findex isqrt
   
   @table @t
   @item isqrt(@var{n})
   \JP :: $BJ?J}:,$r1[$($J$$:GBg$N@0?t$r5a$a$k(B.
   \EG :: The integer square root of @var{n}.
   @end table
   
   @table @var
   @item return
   \JP $BHsIi@0?t(B
   \EG non-negative integer
   @item n
   \JP $BHsIi@0?t(B
   \EG non-negative integer
   @end table
   
 \JP @node inv,,, $B?t$N1i;;(B  \JP @node inv,,, $B?t$N1i;;(B
 \EG @node inv,,, Numbers  \EG @node inv,,, Numbers
 @subsection @code{inv}  @subsection @code{inv}
Line 301  If one of argument is equal to 0, the return 0.
Line 325  If one of argument is equal to 0, the return 0.
 @item return  @item return
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @item i,m  @item i m
 \JP $B@0?t(B  \JP $B@0?t(B
 \EG integer  \EG integer
 @end table  @end table
Line 418  function
Line 442  function
 @findex random  @findex random
   
 @table @t  @table @t
 @item radom([@var{seed}])  @item random([@var{seed}])
 \JP :: $BMp?t$r@8@.$9$k(B.  \JP :: $BMp?t$r@8@.$9$k(B.
 @end table  @end table
   
Line 481  one can trace a single random number sequence arcoss m
Line 505  one can trace a single random number sequence arcoss m
 @findex lrandom  @findex lrandom
   
 @table @t  @table @t
 @item lradom(@var{bit})  @item lrandom(@var{bit})
 \JP :: $BB?G\D9Mp?t$r@8@.$9$k(B.  \JP :: $BB?G\D9Mp?t$r@8@.$9$k(B.
 \EG :: Generates a long random number.  \EG :: Generates a long random number.
 @end table  @end table
Line 692  These functions works also for polynomials with comple
Line 716  These functions works also for polynomials with comple
 [2,11,(2-11*@@i)]  [2,11,(2-11*@@i)]
 @end example  @end example
   
 \JP @node eval,,, $B?t$N1i;;(B  \JP @node eval deval ,,, $B?t$N1i;;(B
 \EG @node eval,,, Numbers  \EG @node eval deval,,, Numbers
 @subsection @code{eval}  @subsection @code{eval}, @code{deval}
 @findex eval  @findex eval
   @findex deval
 @cindex PARI  @cindex PARI
   
 @table @t  @table @t
 @item eval(@var{obj}[,@var{prec}])  @item eval(@var{obj}[,@var{prec}])
   @item deval(@var{obj})
 \JP :: @var{obj} $B$NCM$NI>2A(B.  \JP :: @var{obj} $B$NCM$NI>2A(B.
 \EG :: Evaluate @var{obj} numerically.  \EG :: Evaluate @var{obj} numerically.
 @end table  @end table
Line 721  These functions works also for polynomials with comple
Line 747  These functions works also for polynomials with comple
 @item  @item
 @var{obj} $B$K4^$^$l$kH!?t$NCM$r2DG=$J8B$jI>2A$9$k(B.  @var{obj} $B$K4^$^$l$kH!?t$NCM$r2DG=$J8B$jI>2A$9$k(B.
 @item  @item
 $B7W;;$O(B @b{PARI} (@xref{pari}) $B$,9T$&(B.  @code{deval} $B$OG\@:EYIbF0>.?t$r7k2L$H$7$F(B
   @code{eval} $B$N>l9g(B, $BM-M}?t$O$=$N$^$^;D$k(B.
 @item  @item
   @code{eval} $B$K$*$$$F$O(B, $B7W;;$O(B @b{MPFR} $B%i%$%V%i%j$,9T$&(B.
   @code{deval} $B$K$*$$$F$O(B, $B7W;;$O(B C $B?t3X%i%$%V%i%j$N4X?t$rMQ$$$F9T$&(B.
   @item
   @code{deval} $B$OJ#AG?t$O07$($J$$(B.
   @item
   @code{eval} $B$K$*$$$F$O(B,
 @var{prec} $B$r;XDj$7$?>l9g(B, $B7W;;$O(B, 10 $B?J(B @var{prec} $B7eDxEY$G9T$o$l$k(B.  @var{prec} $B$r;XDj$7$?>l9g(B, $B7W;;$O(B, 10 $B?J(B @var{prec} $B7eDxEY$G9T$o$l$k(B.
 @var{prec} $B$N;XDj$,$J$$>l9g(B, $B8=:_@_Dj$5$l$F$$$k@:EY$G9T$o$l$k(B.  @var{prec} $B$N;XDj$,$J$$>l9g(B, $B8=:_@_Dj$5$l$F$$$k@:EY$G9T$o$l$k(B.
 (@xref{setprec})  (@xref{setbprec setprec}.)
 @item  @item
 @table @t  @table @t
 @item $B07$($kH!?t$O(B, $B<!$NDL$j(B.  @item $B07$($kH!?t$O(B, $B<!$NDL$j(B.
Line 740  These functions works also for polynomials with comple
Line 773  These functions works also for polynomials with comple
 @code{exp}, @code{log}, @code{pow(a,b) (a^b)}  @code{exp}, @code{log}, @code{pow(a,b) (a^b)}
 @end table  @end table
 @item  @item
 $B0J2<$N5-9f$r?t$H$7$FI>2A$G$-$k(B.  $B0J2<$N5-9f$r?t$H$7$FI>2A$G$-$k(B. $B$?$@$7(B @code{@@i} $B$r07$($k$N$O(B
   @code{eval}, @code{deval} $B$N$_$G$"$k(B.
 @table @t  @table @t
 @item @@i  @item @@i
 $B5u?tC10L(B  $B5u?tC10L(B
Line 755  These functions works also for polynomials with comple
Line 789  These functions works also for polynomials with comple
 Evaluates the value of the functions contained in @var{obj} as far as  Evaluates the value of the functions contained in @var{obj} as far as
 possible.  possible.
 @item  @item
 The computation is done by @b{PARI} (@xref{pari}).  @code{deval} returns
   double float. Rational numbers remain unchanged in results from @code{eval}.
 @item  @item
   In @code{eval} the computation is done
   by @b{MPFR} library. In @code{deval} the computation is
   done by the C math library.
   @item
   @code{deval} cannot handle complex numbers.
   @item
 When @var{prec} is specified, computation will be performed with a  When @var{prec} is specified, computation will be performed with a
 precision of about @var{prec}-digits.  precision of about @var{prec}-digits.
 If @var{prec} is not specified, computation is performed with the  If @var{prec} is not specified, computation is performed with the
 precision set currently. (@xref{setprec})  precision set currently. (@xref{setbprec setprec}.)
 @item  @item
 Currently available numerical functions are listed below.  Currently available numerical functions are listed below.
 Note they are only a small part of whole @b{PARI} functions.  
   
 @table @t  @table @t
 @code{sin}, @code{cos}, @code{tan},  @code{sin}, @code{cos}, @code{tan},
Line 776  Note they are only a small part of whole @b{PARI} func
Line 816  Note they are only a small part of whole @b{PARI} func
 @code{exp}, @code{log}, @code{pow(a,b) (a^b)}  @code{exp}, @code{log}, @code{pow(a,b) (a^b)}
 @end table  @end table
 @item  @item
 Symbols for special values are as the followings.  Symbols for special values are as the followings. Note that
   @code{@@i} cannot be handled by @code{deval}.
 @table @t  @table @t
 @item @@i  @item @@i
 unit of imaginary number  unit of imaginary number
Line 798  Napier's number (@t{exp}(1))
Line 839  Napier's number (@t{exp}(1))
 0.86602540378443864674620506632  0.86602540378443864674620506632
 [121] eval(sin(@@pi/3)-3^(1/2)/2,50);  [121] eval(sin(@@pi/3)-3^(1/2)/2,50);
 -2.78791084448179148471 E-58  -2.78791084448179148471 E-58
   [122] eval(1/2);
   1/2
   [123] deval(sin(1)^2+cos(1)^2);
   1
 @end example  @end example
   
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
 @fref{ctrl}, @fref{setprec}, @fref{pari}.  @fref{ctrl}, @fref{setbprec setprec}.
 @end table  @end table
   
 \JP @node pari,,, $B?t$N1i;;(B  \JP @node pari,,, $B?t$N1i;;(B
Line 846  Napier's number (@t{exp}(1))
Line 891  Napier's number (@t{exp}(1))
 $BH!?tCM$NI>2A$r9bB.$K9T$&$3$H$,$G$-$k(B. @b{PARI} $B$OB>$N%W%m%0%i%`$+$i(B  $BH!?tCM$NI>2A$r9bB.$K9T$&$3$H$,$G$-$k(B. @b{PARI} $B$OB>$N%W%m%0%i%`$+$i(B
 $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  $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
 @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  @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
 $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  $BMxMQ$9$k$3$H$b$G$-$k(B.
 site ($B$?$H$($P(B @code{ftp://megrez.ceremab.u-bordeaux.fr/pub/pari})  
 $B$+$i(B anonymous ftp $B$G$-$k(B.  
 @item  @item
 $B:G8e$N0z?t(B @var{prec} $B$G7W;;@:EY$r;XDj$G$-$k(B.  $B:G8e$N0z?t(B @var{prec} $B$G7W;;@:EY$r;XDj$G$-$k(B.
 @var{prec} $B$r>JN,$7$?>l9g(B @code{setprec()} $B$G;XDj$7$?@:EY$H$J$k(B.  @var{prec} $B$r>JN,$7$?>l9g(B @code{setprec()} $B$G;XDj$7$?@:EY$H$J$k(B.
Line 870  function evaluations as well as arithmetic operations 
Line 913  function evaluations as well as arithmetic operations 
 speed.  It can also be used from other external programs as a library.  speed.  It can also be used from other external programs as a library.
 It provides a language interface named @samp{gp} to its library, which  It provides a language interface named @samp{gp} to its library, which
 enables a user to use @b{PARI} as a calculator which runs on UNIX.  enables a user to use @b{PARI} as a calculator which runs on UNIX.
 The current version is @b{2.0.17beta}.  It can be obtained by several ftp  
 sites. (For example, @code{ftp://megrez.ceremab.u-bordeaux.fr/pub/pari}.)  
 @item  @item
 The last argument (optional) @var{int} specifies the precision in digits  The last argument (optional) @var{int} specifies the precision in digits
 for bigfloat operation.  for bigfloat operation.
Line 960  For details of individual functions, refer to the @b{P
Line 1001  For details of individual functions, refer to the @b{P
 @code{lngamma},  @code{lngamma},
 @code{logagm},  @code{logagm},
 @code{mat},  @code{mat},
 @code{matinvr},  
 @code{matrixqz2},  @code{matrixqz2},
 @code{matrixqz3},  @code{matrixqz3},
 @code{matsize},  @code{matsize},
Line 1019  For details of individual functions, refer to the @b{P
Line 1059  For details of individual functions, refer to the @b{P
   
 \BJP  \BJP
 @item  @item
 @b{Asir} $B$GMQ$$$F$$$k$N$O(B @b{PARI} $B$N$[$s$N0lIt$N5!G=$G$"$k$,(B, $B:#8e(B  @b{Asir} $B$GMQ$$$F$$$k$N$O(B @b{PARI} $B$N$[$s$N0lIt$N5!G=$G$"$k(B.
 $B$h$jB?$/$N5!G=$,MxMQ$G$-$k$h$&2~NI$9$kM=Dj$G$"$k(B.  
 \E  \E
 \BEG  \BEG
 @item  @item
 @b{Asir} currently uses only a very small subset of @b{PARI}.  @b{Asir} currently uses only a very small subset of @b{PARI}.
 We will improve @b{Asir} so that it can provide more functions of  
 @b{PARI}.  
 \E  \E
 @end itemize  @end itemize
   
Line 1045  We will improve @b{Asir} so that it can provide more f
Line 1082  We will improve @b{Asir} so that it can provide more f
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 \EG @item References  \EG @item References
 @fref{setprec}.  @fref{setbprec setprec}.
 @end table  @end table
   
 \JP @node setprec,,, $B?t$N1i;;(B  \JP @node setbprec setprec,,, $B?t$N1i;;(B
 \EG @node setprec,,, Numbers  \EG @node setbprec setprec,,, Numbers
 @subsection @code{setprec}  @subsection @code{setbprec}, @code{setprec}
   @findex setbprec
 @findex setprec  @findex setprec
 @cindex PARI  
   
 @table @t  @table @t
 @item setprec([@var{n}])  @item setbprec([@var{n}])
 \JP :: @b{bigfloat} $B$N7e?t$r(B @var{n} $B7e$K@_Dj$9$k(B.  @itemx setprec([@var{n}])
 \EG :: Sets the precision for @b{bigfloat} operations to @var{n} digits.  \JP :: @b{setbprec}, @b{setprec} $B$O(B @b{bigfloat} $B$N@:EY$r$=$l$>$l(B 2 $B?J(B, 10$B?J(B @var{n} $B7e$K@_Dj$9$k(B.
   \EG :: @b{setbprec}, @b{setprec} set the precision for @b{bigfloat} operations to @var{n} bits, @var{n} digits respectively.
 @end table  @end table
   
 @table @var  @table @var
Line 1075  We will improve @b{Asir} so that it can provide more f
Line 1113  We will improve @b{Asir} so that it can provide more f
 $B0z?t$,$"$k>l9g(B, @b{bigfloat} $B$N7e?t$r(B @var{n} $B7e$K@_Dj$9$k(B.  $B0z?t$,$"$k>l9g(B, @b{bigfloat} $B$N7e?t$r(B @var{n} $B7e$K@_Dj$9$k(B.
 $B0z?t$N$"$k$J$7$K$+$+$o$i$:(B, $B0JA0$K@_Dj$5$l$F$$$?CM$rJV$9(B.  $B0z?t$N$"$k$J$7$K$+$+$o$i$:(B, $B0JA0$K@_Dj$5$l$F$$$?CM$rJV$9(B.
 @item  @item
 @b{bigfloat} $B$N7W;;$O(B @b{PARI} (@xref{pari}) $B$K$h$C$F9T$o$l$k(B.  @b{bigfloat} $B$N7W;;$O(B @b{MPFR} $B%i%$%V%i%j$K$h$C$F9T$o$l$k(B.
 @item  @item
 @b{bigfloat} $B$G$N7W;;$KBP$7M-8z$G$"$k(B.  @b{bigfloat} $B$G$N7W;;$KBP$7M-8z$G$"$k(B.
 @b{bigfloat} $B$N(B flag $B$r(B on $B$K$9$kJ}K!$O(B, @code{ctrl} $B$r;2>H(B.  @b{bigfloat} $B$N(B flag $B$r(B on $B$K$9$kJ}K!$O(B, @code{ctrl} $B$r;2>H(B.
Line 1085  We will improve @b{Asir} so that it can provide more f
Line 1123  We will improve @b{Asir} so that it can provide more f
 \E  \E
 \BEG  \BEG
 @item  @item
 When an argument is given, it  When an argument @var{n} is given, these functions
 sets the precision for @b{bigfloat} operations to @var{n} digits.  set the precision for @b{bigfloat} operations to @var{n} bits or @var{n} digits.
 The return value is always the previous precision in digits regardless of  The return value is always the previous precision regardless of
 the existence of an argument.  the existence of an argument.
   
 @item  @item
 @b{Bigfloat} operations are done by @b{PARI}. (@xref{pari})  @b{Bigfloat} operations are done by @b{MPFR} library.
 @item  @item
 This is effective for computations in @b{bigfloat}.  This is effective for computations in @b{bigfloat}.
 Refer to @code{ctrl()} for turning on the `@b{bigfloat} flag.'  Refer to @code{ctrl()} for turning on the `@b{bigfloat} flag.'
Line 1104  Therefore, it is safe to specify a larger value.
Line 1142  Therefore, it is safe to specify a larger value.
   
 @example  @example
 [1] setprec();  [1] setprec();
 9  15
 [2] setprec(100);  [2] setprec(100);
 9  15
 [3] setprec(100);  [3] setprec(100);
 96  99
   [4] setbprec();
   332
 @end example  @end example
   
 @table @t  @table @t
 \JP @item $B;2>H(B  \JP @item $B;2>H(B
 @fref{ctrl}, @fref{eval}, @fref{pari}.  @fref{ctrl}, @fref{eval deval}.
 @end table  @end table
   
   \JP @node setround,,, $B?t$N1i;;(B
   \EG @node setround,,, Numbers
   @subsection @code{setround}
   @findex setround
   
   @table @t
   @item setround([@var{mode}])
   \JP :: @b{bigfloat} $B$N4]$a%b!<%I$r(B @var{mode} $B$K@_Dj$9$k(B.
   \EG :: Sets the rounding mode @var{mode}.
   @end table
   
   @table @var
   @item return
   \JP $B@0?t(B
   \EG integer
   @item mode
   \JP $B@0?t(B
   \EG integer
   @end table
   
   @itemize @bullet
   \BJP
   @item
   $B0z?t$,$"$k>l9g(B, @b{bigfloat} $B$N4]$a%b!<%I$r(B @var{mode} $B$K@_Dj$9$k(B.
   $B0z?t$N$"$k$J$7$K$+$+$o$i$:(B, $B0JA0$K@_Dj$5$l$F$$$?CM$rJV$9(B.
   $B4]$a%b!<%I$N0UL#$O<!$N$H$*$j(B.
   @table @code
   @item 0
   Round to nearest
   @item 1
   Round toward 0
   @item 2
   Round toward +infinity
   @item 3
   Round toward -infinity
   @end table
   @item
   @b{bigfloat} $B$G$N7W;;$KBP$7M-8z$G$"$k(B.
   @b{bigfloat} $B$N(B flag $B$r(B on $B$K$9$kJ}K!$O(B, @code{ctrl} $B$r;2>H(B.
   \E
   \BEG
   @item
   When an argument @var{mode} is given, these functions
   set the rounding mode for @b{bigfloat} operations to @var{mode}.
   The return value is always the previous rounding mode regardless of
   the existence of an argument.
   The meanings of rounding modes are as follows
   @table @code
   @item 0
   Round to nearest
   @item 1
   Round toward 0
   @item 2
   Round toward +infinity
   @item 3
   Round toward -infinity
   @end table
   
   @item
   This is effective for computations in @b{bigfloat}.
   Refer to @code{ctrl()} for turning on the `@b{bigfloat} flag.'
   \E
   @end itemize
   
   @example
   [1] setprec();
   15
   [2] setprec(100);
   15
   [3] setprec(100);
   99
   [4] setbprec();
   332
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   @fref{ctrl}, @fref{eval deval}.
   @end table
   
   
 \JP @node setmod,,, $B?t$N1i;;(B  \JP @node setmod,,, $B?t$N1i;;(B
 \EG @node setmod,,, Numbers  \EG @node setmod,,, Numbers
 @subsection @code{setmod}  @subsection @code{setmod}
Line 1177  return to toplevel
Line 1298  return to toplevel
 \EG @fref{dp_mod dp_rat}, @fref{Types of numbers}.  \EG @fref{dp_mod dp_rat}, @fref{Types of numbers}.
 @end table  @end table
   
   \JP @node ntoint32 int32ton,,, $B?t$N1i;;(B
   \EG @node ntoint32 int32ton,,, Numbers
   @subsection @code{ntoint32}, @code{int32ton}
   @findex ntoint32
   @findex int32ton
   
   @table @t
   @item ntoint32(@var{n})
   @itemx int32ton(@var{int32})
   \JP :: $BHsIi@0?t$HId9f$J$7(B 32bit $B@0?t$N4V$N7?JQ49(B.
   \EG :: Type-conversion between a non-negative integer and an unsigned 32bit integer.
   @end table
   
   @table @var
   @item return
   \JP $BId9f$J$7(B 32bit $B@0?t$^$?$OHsIi@0?t(B
   \EG unsigned 32bit integer or non-negative integer
   @item n
   \JP 2^32 $BL$K~$NHsIi@0?t(B
   \EG non-negative interger less than 2^32
   @item int32
   \JP $BId9f$J$7(B 32bit $B@0?t(B
   \EG unsigned 32bit integer
   @end table
   
   @itemize @bullet
   \BJP
   @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,
   $B$^$?$O$=$N5UJQ49$r9T$&(B.
   @item 32bit $B@0?t$O(B @b{OpenXM} $B$N4pK\9=@.MWAG$G$"$j(B, $B@0?t$r$=$N7?$GAw?.(B
   $B$9$kI,MW$,$"$k>l9g$KMQ$$$k(B.
   \E
   \BEG
   @item These functions do conversions between non-negative
   integers (the type id 1) and unsigned 32bit integers (the type id 10).
   @item An unsigned 32bit integer is a fundamental construct of @b{OpenXM}
   and one often has to send an integer to a server as an unsigned 32bit
   integer. These functions are used in such a case.
   \E
   @end itemize
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   \JP @fref{$BJ,;67W;;(B}, @fref{$B?t$N7?(B}.
   \EG @fref{Distributed computation}, @fref{Types of numbers}.
   @end table
   
   \JP @node inttorat,,, $B?t$N1i;;(B
   \EG @node inttorat,,, Numbers
   @subsection @code{inttorat}
   @findex inttorat
   
   @table @t
   @item inttorat(@var{a},@var{m},@var{b})
   \JP :: $B@0?t(B-$BM-M}?tJQ49$r9T$&(B.
   \EG :: Perform the rational reconstruction.
   @end table
   
   @table @var
   @item return
   \JP $B%j%9%H$^$?$O(B 0
   \EG list or 0
   @item a
   @itemx m
   @itemx b
   \JP $B@0?t(B
   \EG integer
   @end table
   
   @itemize @bullet
   \BJP
   @item
   $B@0?t(B @var{a} $B$KBP$7(B, @var{xa=y} mod @var{m} $B$rK~$?$9@5@0?t(B @var{x}, $B@0?t(B @var{y}
   (@var{x}, @var{|y|} < @var{b}, @var{GCD(x,y)=1}) $B$r5a$a$k(B.
   @item
   $B$3$N$h$&$J(B @var{x}, @var{y} $B$,B8:_$9$k$J$i(B @var{[y,x]} $B$rJV$7(B, $BB8:_$7$J$$>l9g$K$O(B 0 $B$rJV$9(B.
   @item
   @var{b} $B$r(B @var{floor(sqrt(m/2))} $B$H<h$l$P(B, @var{x}, @var{y} $B$OB8:_$9$l$P0l0U$G$"$k(B.
   @var{floor(sqrt(m/2))} $B$O(B @code{isqrt(floor(m/2))} $B$G7W;;$G$-$k(B.
   @end itemize
   \E
   \BEG
   @item
   For an integer @var{a}, find a positive integer @var{x} and an intger @var{y} satisfying
   @var{xa=y} mod @var{m}, @var{x}, @var{|y|} < @var{b} and @var{GCD(x,y)=1}.
   @item
   If such @var{x}, @var{y} exist then a list @var{[y,x]} is returned. Otherwise 0 is returned.
   @item
   If @var{b} is set to @var{floor(sqrt(M/2))}, then @var{x} and @var{y} are unique if they
   exist. @var{floor(sqrt(M/2))} can be computed by @code{floor} and @code{isqrt}.
   @end itemize
   \E
   
   @example
   [2121] M=lprime(0)*lprime(1);
   9996359931312779
   [2122] B=isqrt(floor(M/2));
   70697807
   [2123] A=234234829304;
   234234829304
   [2124] inttorat(A,M,B);
   [-20335178,86975031]
   @end example
   
   @table @t
   \JP @item $B;2>H(B
   \EG @item References
   @fref{floor}, @fref{isqrt}.
   @end table

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.13

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>