version 1.12, 2016/08/29 04:56:58 |
version 1.13, 2019/03/29 01:57:46 |
|
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/num.texi,v 1.11 2016/03/22 07:25:14 noro Exp $ |
@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 |
|
|
* lrandom:: |
* lrandom:: |
* ntoint32 int32ton:: |
* ntoint32 int32ton:: |
* setround:: |
* setround:: |
|
* inttorat:: |
@end menu |
@end menu |
|
|
\JP @node idiv irem,,, $B?t$N1i;;(B |
\JP @node idiv irem,,, $B?t$N1i;;(B |
Line 1343 integer. These functions are used in such a case. |
|
Line 1344 integer. These functions are used in such a case. |
|
\EG @item References |
\EG @item References |
\JP @fref{$BJ,;67W;;(B}, @fref{$B?t$N7?(B}. |
\JP @fref{$BJ,;67W;;(B}, @fref{$B?t$N7?(B}. |
\EG @fref{Distributed computation}, @fref{Types of numbers}. |
\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 |
@end table |