Annotation of OpenXM/doc/OpenXM-specs/cmo-basic1.tex, Revision 1.16
1.16 ! takayama 1: %% $OpenXM: OpenXM/doc/OpenXM-specs/cmo-basic1.tex,v 1.15 2016/08/22 05:38:27 takayama Exp $
! 2: //&jp \section{ 数, 多項式 の CMO 表現 }
1.1 noro 3: //&eg \section{ CMOexpressions for numbers and polynomials }
1.4 noro 4: \label{sec:basic1}
1.1 noro 5: /*&C
6: @../SSkan/plugin/cmotag.h
7: \begin{verbatim}
8: #define CMO_MONOMIAL32 19
9: #define CMO_ZZ 20
10: #define CMO_QQ 21
11: #define CMO_ZERO 22
12: #define CMO_DMS_GENERIC 24
13: #define CMO_DMS_OF_N_VARIABLES 25
14: #define CMO_RING_BY_NAME 26
15: #define CMO_DISTRIBUTED_POLYNOMIAL 31
16: #define CMO_RATIONAL 34
1.14 noro 17: #define CMO_COMPLEX 35
1.1 noro 18:
1.15 takayama 19: #define CMO_BIGFLOAT32 52
1.1 noro 20:
21: #define CMO_INDETERMINATE 60
22: #define CMO_TREE 61
23: #define CMO_LAMBDA 62 /* for function definition */
24: \end{verbatim}
25:
26: */
27:
28: /*&jp
1.16 ! takayama 29: 以下, グループ CMObject/Basic, CMObject/Tree
! 30: および CMObject/DistributedPolynomial
! 31: に属する CMObject の形式を説明する.
1.1 noro 32:
1.5 noro 33: \noindent
1.16 ! takayama 34: {\tt OpenXM/src/ox\_toolkit} にある {\tt bconv} をもちいると
! 35: CMO expression を binary format に変換できるので,
! 36: これを参考にするといい.
1.1 noro 37: */
38: /*&eg
39: In the sequel, we will explain on the groups
1.4 noro 40: CMObject/Basic, CMObject/Tree
1.1 noro 41: and CMObject/DistributedPolynomial.
1.5 noro 42:
43: \noindent
44: The program {\tt bconv} at {\tt OpenXM/src/ox\_toolkit}
45: translates
46: CMO expressions into binary formats.
47: It is convinient to understand the binary formats explained in
48: this section.
1.1 noro 49: */
50:
1.5 noro 51: /*&C
52: \noindent Example:
53: \begin{verbatim}
54: bash$ ./bconv
55: > (CMO_ZZ,123123);
56: 00 00 00 14 00 00 00 01 00 01 e0 f3
57: \end{verbatim}
58: */
1.1 noro 59: /*&jp
60:
61: \bigbreak
62: \noindent
1.4 noro 63: Group CMObject/Basic requires CMObject/Primitive. \\
1.12 takayama 64: ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/Basic. \\
1.1 noro 65: \begin{eqnarray*}
66: \mbox{Zero} &:& ({\tt CMO\_ZERO}) \\
1.16 ! takayama 67: & & \mbox{ --- ユニバーサルな ゼロを表す. } \\
1.12 takayama 68: \mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots ,
1.9 noro 69: {\sl byte}\, \mbox{a[$|$f$|$]} ) \\
1.16 ! takayama 70: &:& \mbox{ --- bignum をあらわす. a[i] についてはあとで説明}\\
1.9 noro 71: \mbox{QQ} &:& ({\tt CMO\_QQ},
72: {\sl int32}\, {\rm m}, {\sl byte}\, \mbox{a[1]}, \ldots, {\sl byte}\, \mbox{a[$|$m$|$]},
73: {\sl int32}\, {\rm n}, {\sl byte}\, \mbox{b[1]}, \ldots, {\sl byte}\, \mbox{b[$|$n$|$]})\\
1.16 ! takayama 74: & & \mbox{ --- 有理数 $a/b$ を表す. } \\
1.1 noro 75: \mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\
1.16 ! takayama 76: & & \mbox{ --- $a/b$ を表す. } \\
1.15 takayama 77: \mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32},
78: {\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp},
79: {\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\
1.16 ! takayama 80: &:& \mbox{ --- bigfloat をあらわす. a[i], k についてはあとで説明}\\
1.14 noro 81: \mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\
1.16 ! takayama 82: & & \mbox{ --- $a+b\sqrt{-1}$ を表す. } \\
1.1 noro 83: \mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\
1.16 ! takayama 84: & & \mbox{ --- 変数名 $v$ . } \\
1.1 noro 85: \end{eqnarray*}
86: */
1.12 takayama 87:
88:
1.1 noro 89: /*&eg
90:
91: \bigbreak
92: \noindent
1.4 noro 93: Group CMObject/Basic requires CMObject/Primitive. \\
1.12 takayama 94: ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/Basic. \\
1.1 noro 95: \begin{eqnarray*}
96: \mbox{Zero} &:& ({\tt CMO\_ZERO}) \\
97: & & \mbox{ --- Universal zero } \\
1.12 takayama 98: \mbox{ZZ} &:& ({\tt CMO\_ZZ},{\sl int32}\, {\rm f}, {\sl byte}\, \mbox{a[1]}, \ldots ,
1.9 noro 99: {\sl byte}\, \mbox{a[$|$m$|$]} ) \\
1.1 noro 100: &:& \mbox{ --- bignum. The meaning of a[i] will be explained later.}\\
1.9 noro 101: \mbox{QQ} &:& ({\tt CMO\_QQ},
102: {\sl int32}\, {\rm m}, {\sl byte}\, \mbox{a[1]}, \ldots, {\sl byte}\, \mbox{a[$|$m$|$]},
103: {\sl int32}\, {\rm n}, {\sl byte}\, \mbox{b[1]}, \ldots, {\sl byte}\, \mbox{b[$|$n$|$]})\\
1.1 noro 104: & & \mbox{ --- Rational number $a/b$. } \\
105: \mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\
106: & & \mbox{ --- Rational expression $a/b$. } \\
1.15 takayama 107: \mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32},
108: {\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp},
109: {\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\
110: &:& \mbox{ --- bigfloat. The meaning of a[i], k will be explained later.}\\
1.14 noro 111: \mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\
112: & & \mbox{ --- Complex number $a+b\sqrt{-1}$. } \\
1.1 noro 113: \mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\
114: & & \mbox{ --- Variable name $v$ . } \\
115: \end{eqnarray*}
116: */
117: /*&C
118:
119: */
1.12 takayama 120: /*&C
121:
122: */
1.1 noro 123:
124: /*&jp
1.16 ! takayama 125: Indeterminate は変数名をあらわす.
! 126: v はバイト列であればなにを用いてもよいが,
! 127: システム毎に変数名として用いられるバイト列は制限がある.
! 128: 各システム xxx は任意の文字列を各システム固有の変数名へ1対1に変換できるように
! 129: 実装しないといけない.
! 130: (これを
! 131: {\tt Dx} は {\tt \#dx} と変換するなどの
! 132: escape sequence を用いて実現するのは, 無理があるようである.
! 133: テーブルを作成する必要があるであろう.)
1.1 noro 134: */
135: /*&eg
1.12 takayama 136: The name of a variable should be expressed by using Indeterminate.
1.1 noro 137: v may be any sequence of bytes, but each system has its own
138: restrictions on the names of variables.
139: Indeterminates of CMO and internal variable names must be translated
1.12 takayama 140: in one-to-one correspondence.
1.1 noro 141: */
142:
1.12 takayama 143:
1.1 noro 144: /*&jp
1.16 ! takayama 145: \subsection{Indeterminate および Tree}
1.1 noro 146:
147: \noindent
1.4 noro 148: Group CMObject/Tree requires CMObject/Basic. \\
1.12 takayama 149: Tree, Lambda $\in$ CMObject/Tree. \\
1.1 noro 150: \begin{eqnarray*}
151: \mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name},
1.11 takayama 152: {\sl List}\, {\rm attributes}, {\sl List}\, {\rm leaves}) \\
1.16 ! takayama 153: & & \mbox{ --- 名前 name の定数または関数. 関数の評価はおこなわない. } \\
! 154: & & \mbox{ --- attributes は空リストでなければ name の属性を保持している. }\\
! 155: & & \mbox{ --- 属性リストは, key と 値のペアである. }\\
1.1 noro 156: \mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args},
157: {\sl Tree} {\rm body}) \\
1.16 ! takayama 158: & & \mbox{ --- body を args を引数とする関数とする. } \\
1.1 noro 159: \end{eqnarray*}
160: */
161: /*&eg
1.12 takayama 162: \subsection{Indeterminate and Tree}
1.1 noro 163:
164: \noindent
1.4 noro 165: Group CMObject/Tree requires CMObject/Basic. \\
1.12 takayama 166: Tree, Lambda $\in$ CMObject/Tree. \\
1.1 noro 167: \begin{eqnarray*}
168: \mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name},
1.11 takayama 169: {\sl List}\, {\rm attributes}, {\sl List}\, {\rm leaves}) \\
1.12 takayama 170: & & \mbox{ --- ``name'' is the name of the node of the tree. } \\
171: & & \mbox{ --- Attributes may be a null list. If it is not null, it is a list of}\\
1.11 takayama 172: & & \mbox{ --- key and value pairs. } \\
1.1 noro 173: \mbox{Lambda} &:& ({\tt CMO\_LAMBDA}, {\sl List}\, {\rm args},
174: {\sl Tree} {\rm body}) \\
175: & & \mbox{ --- a function with the arguments body. } \\
176: \end{eqnarray*}
177: */
178:
179: /*&jp
1.16 ! takayama 180: 数式を処理するシステムでは, Tree 構造が一般にもちいられる.
! 181: たとえば, $\sin(x+e)$ は,
1.1 noro 182: {\tt (sin, (plus, x, e))}
1.16 ! takayama 183: なる Tree であらわすのが一般的である.
! 184: Tree の表現を スタックマシンのレベルでおこなうとすると,
! 185: {\tt ox\_BEGIN\_BLOCK}, {\tt ox\_END\_BLOCK} で評価を抑制するのが
! 186: 一つの方法である (cf. Postscript の {\tt \{ }, {\tt \} }).
! 187: たとえば上の方法では
! 188: {\tt x, e, plus, sin } を begin block, end block でかこめばよろしい.
! 189: われわれはスタックマシンの実装をなるべく簡単にするという立場をとりたい,
! 190: また数学オブジェクトを OX スタックマシンと CMObject を混在して表現したく
! 191: ない.
! 192: したがって,
! 193: Tree 構造は Open Math 風の表現をもちいた CMO を導入することにした.
! 194: またこのほうが, われわれの想定するシステム xxx において, Open XM 対応が
! 195: はるかに容易である.
! 196: なお, Tree は, Open Math では, Symbol, Application のメカニズムに相当する.
1.1 noro 197: */
198: /*&eg
199: In many computer algebra systems, mathematical expressions are usually
200: expressed in terms of a tree structure.
201: For example,
202: $\sin(x+e)$ is expressed as
203: {\tt (sin, (plus, x, e))}
204: as a tree.
1.4 noro 205: Tree may be expressed by putting the expression between
1.3 noro 206: {\tt SM\_beginBlock} and {\tt SM\_endBlock}, which are
207: stack machine commands for delayed evaluation.
208: (cf. {\tt \{ }, {\tt \} } in PostScript).
209: However it makes the implementation of stack machines complicated.
210: It is desirable that CMObject is independent of OX stack machine.
211: Therefore we introduce an OpenMath like tree representation for CMO
1.7 noro 212: Tree object.
1.3 noro 213: This method allows us to implement tree structure easily
214: on individual OpenXM systems.
215: Note that CMO Tree corresponds to Symbol and Application in OpenMath.
1.1 noro 216: */
217:
218:
219: /*&C
220:
221: */
222: /*&jp
1.16 ! takayama 223: Lambda は関数を定義するための関数である.
! 224: Lisp の Lambda 表現と同じ.
1.3 noro 225: */
226: /*&eg
227: Lambda is used to define functions.
1.12 takayama 228: The notion ``lambda'' is borrowed from the language Lisp.
1.3 noro 229: */
1.1 noro 230:
231: \noindent
1.16 ! takayama 232: //&jp 例: $sin(x+e)$ の表現.
1.3 noro 233: //&eg Example: the expression of $sin(x+e)$.
1.1 noro 234: \begin{verbatim}
1.11 takayama 235: (CMO_TREE, (CMO_STRING, "sin"),
236: (CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"),
237: (CMO_STRING,"basic")))
1.1 noro 238: (CMO_LIST,[size=]1,
239: (CMO_TREE, (CMO_STRING, "plus"), (CMO_STRING, "basic"),
240: (CMO_LIST,[size=]2, (CMO_INDETERMINATE,"x"),
1.16 ! takayama 241: //&jp (CMO_TREE,(CMO_STRING, "e"), 自然対数の底
1.6 noro 242: //&eg (CMO_TREE,(CMO_STRING, "e"), the base of natural logarithms
1.12 takayama 243: (CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"),
244: (CMO_STRING,"basic")))
1.1 noro 245: ))
246: )
247: )
248: \end{verbatim}
1.16 ! takayama 249: //&jp Leave の成分には, 多項式を含む任意のオブジェクトがきてよい.
1.10 takayama 250: //&eg Elements of the leave may be any objects including polynomials.
1.1 noro 251:
252: \noindent
253: Example:
254: \begin{verbatim}
1.12 takayama 255: sm1> [(plus) [[(cdname) (basic)]] [(123).. (345)..]] [(class) (tree)] dc ::
256: Class.tree [$plus$ , [[$cdname$ , $basic$ ]], [ 123 , 345 ] ]
1.1 noro 257: \end{verbatim}
258:
1.12 takayama 259: \noindent
260: Example:
261: \begin{verbatim}
262: asir
263: [753] taka_cmo100_xml_form(quote(sin(x+1)));
264: <cmo_tree> <cmo_string>"sin"</cmo_string>
265: <cmo_list><cmo_int32 for="length">1</cmo_int32>
266: <cmo_list><cmo_int32 for="length">2</cmo_int32>
267: <cmo_string>"cdname"</cmo_string>
268: <cmo_string>"basic"</cmo_string>
269: </cmo_list> </cmo_list>
270: <cmo_tree> <cmo_string>"plus"</cmo_string>
271: <cmo_list><cmo_int32 for="length">1</cmo_int32>
272: <cmo_list><cmo_int32 for="length">2</cmo_int32>
273: <cmo_string>"cdname"</cmo_string>
274: <cmo_string>"basic"</cmo_string>
275: </cmo_list> </cmo_list>
276: <cmo_indeterminate> <cmo_string>"x"</cmo_string> </cmo_indeterminate>
277: <cmo_zz>1</cmo_zz>
278: </cmo_tree></cmo_tree>
279: \end{verbatim}
1.1 noro 280:
281:
282: \bigbreak
1.16 ! takayama 283: //&jp 次に, 分散表現多項式に関係するグループを定義しよう.
1.4 noro 284: /*&eg
1.12 takayama 285: Let us define a group for distributed polynomials. In the following,
1.4 noro 286: DMS stands for Distributed Monomial System.
287: */
1.1 noro 288:
289: \medbreak
290: \noindent
1.4 noro 291: Group CMObject/DistributedPolynomials requires CMObject/Primitive,
292: CMObject/Basic. \\
1.1 noro 293: Monomial, Monomial32, Coefficient, Dpolynomial, DringDefinition,
294: Generic DMS ring, RingByName, DMS of N variables $\in$
295: CMObject/DistributedPolynomials. \\
1.3 noro 296: /*&jp
1.1 noro 297: \begin{eqnarray*}
298: \mbox{Monomial} &:& \mbox{Monomial32}\, |\, \mbox{Zero} \\
299: \mbox{Monomial32}&:& ({\tt CMO\_MONOMIAL32}, {\sl int32}\, n,
300: {\sl int32}\, \mbox{e[1]}, \ldots,
301: {\sl int32}\, \mbox{e[n]}, \\
302: & & \ \mbox{Coefficient}) \\
1.16 ! takayama 303: & & \mbox{ --- e[i] で, $n$ 変数 monomial
! 304: $x^e = x_1^{e_1} \cdots x_n^{e_n}$ の各指数 $e_i$
! 305: をあらわす.} \\
1.1 noro 306: \mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\
307: \mbox{Dpolynomial}&:& \mbox{Zero} \\
1.12 takayama 308: & & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32}\, m, \\
1.1 noro 309: & & \ \ \mbox{DringDefinition},
310: [\mbox{Monomial32}|\mbox{Zero}], \\
311: & &\ \
312: \{\mbox{Monomial32}\}) \\
1.16 ! takayama 313: & &\mbox{--- m はモノミアルの個数である.}\\
1.1 noro 314: \mbox{DringDefinition}
315: &:& \mbox{DMS of N variables} \\
316: & & |\ \mbox{RingByName} \\
317: & & |\ \mbox{Generic DMS ring} \\
1.16 ! takayama 318: & & \mbox{ --- 分散表現多項式環の定義. } \\
1.1 noro 319: \mbox{Generic DMS ring}
1.16 ! takayama 320: &:& \mbox{({\tt CMO\_DMS\_GENERIC}) --- 新版はこちら}\\
1.1 noro 321: \mbox{RingByName}&:& ({\tt CMO\_RING\_BY\_NAME}, {\sl Cstring}\ {\rm s}) \\
1.16 ! takayama 322: & & \mbox{ --- 名前 s で, 格納された ring 定義.} \\
1.1 noro 323: \mbox{DMS of N variables}
324: &:& ({\tt CMO\_DMS\_OF\_N\_VARIABLES}, \\
325: & & \ ({\tt CMO\_LIST}, {\sl int32}\, \mbox{m},
326: {\sl Integer32}\, \mbox{n}, {\sl Integer32}\,\mbox{p} \\
327: & & \ \ [,{\sl object}\,\mbox{s}, {\sl Cstring}\,\mbox{c},
328: {\sl List}\, \mbox{vlist},
329: {\sl List}\, \mbox{wvec}, {\sl List}\, \mbox{outord}]) \\
1.16 ! takayama 330: & & \mbox{ --- m はあとに続く要素の数} \\
! 331: & & \mbox{ --- n は変数の数, p は 標数} \\
! 332: & & \mbox{ --- s は ring の名前} \\
! 333: & & \mbox{ --- c は係数環, QQ, ZZ の場合は文字列で QQ, ZZ と書く.} \\
! 334: & & \mbox{ --- vlist は Indeterminate のリスト(新版). 多項式環の変数リスト} \\
! 335: & & \mbox{ --- wvec は order をきめる weight vector,} \\
! 336: & & \mbox{ --- outord は出力するときの変数順序.} \\
1.1 noro 337: \end{eqnarray*}
1.3 noro 338: */
339: /*&eg
340: \begin{eqnarray*}
341: \mbox{Monomial} &:& \mbox{Monomial32}\, |\, \mbox{Zero} \\
342: \mbox{Monomial32}&:& ({\tt CMO\_MONOMIAL32}, {\sl int32}\, n,
343: {\sl int32}\, \mbox{e[1]}, \ldots,
344: {\sl int32}\, \mbox{e[n]}, \\
345: & & \ \mbox{Coefficient}) \\
346: & & \mbox{ --- e[i] is the exponent $e_i$ of the monomial
347: $x^e = x_1^{e_1} \cdots x_n^{e_n}$. } \\
348: \mbox{Coefficient}&:& \mbox{ZZ} | \mbox{Integer32} \\
349: \mbox{Dpolynomial}&:& \mbox{Zero} \\
1.12 takayama 350: & & |\ ({\tt CMO\_DISTRIBUTED\_POLYNOMIAL},{\sl int32}\, m, \\
1.3 noro 351: & & \ \ \mbox{DringDefinition}, [\mbox{Monomial32}|\mbox{Zero}], \\
352: & &\ \
353: \{\mbox{Monomial32}\}) \\
354: & &\mbox{--- m is equal to the number of monomials.}\\
355: \mbox{DringDefinition}
356: &:& \mbox{DMS of N variables} \\
357: & & |\ \mbox{RingByName} \\
358: & & |\ \mbox{Generic DMS ring} \\
359: & & \mbox{ --- definition of the ring of distributed polynomials. } \\
360: \mbox{Generic DMS ring}
361: &:& ({\tt CMO\_DMS\_GENERIC}) \\
362: \mbox{RingByName}&:& ({\tt CMO\_RING\_BY\_NAME}, {\sl Cstring} s) \\
1.4 noro 363: & & \mbox{ --- The ring definition referred by the name ``s''.} \\
1.3 noro 364: \mbox{DMS of N variables}
365: &:& ({\tt CMO\_DMS\_OF\_N\_VARIABLES}, \\
366: & & \ ({\tt CMO\_LIST}, {\sl int32}\, \mbox{m},
367: {\sl Integer32}\, \mbox{n}, {\sl Integer32}\, \mbox{p} \\
368: & & \ \ [,{\sl Cstring}\,\mbox{s}, {\sl List}\, \mbox{vlist},
369: {\sl List}\, \mbox{wvec}, {\sl List}\, \mbox{outord}]) \\
370: & & \mbox{ --- m is the number of elements.} \\
371: & & \mbox{ --- n is the number of variables, p is the characteristic} \\
372: & & \mbox{ --- s is the name of the ring, vlist is the list of variables.} \\
373: & & \mbox{ --- wvec is the weight vector.} \\
374: & & \mbox{ --- outord is the order of variables to output.} \\
375: \end{eqnarray*}
376: */
1.1 noro 377:
1.3 noro 378: /*&jp
1.16 ! takayama 379: RingByName や DMS of N variables はなくても, DMS を定義できる.
! 380: したがって, これらを実装してないシステムで DMS を扱うものが
! 381: あってもかまわない.
1.1 noro 382:
1.16 ! takayama 383: 以下, 以上の CMObject にたいする,
! 384: xxx = asir, kan の振舞いを記述する.
1.3 noro 385: */
386: /*&eg
387: Note that it is possible to define DMS without RingByName and
388: DMS of N variables.
389:
390: In the following we describe how the above CMObjects
391: are implemented on Asir and Kan.
392: */
1.1 noro 393:
394: \subsection{ Zero}
1.3 noro 395: /*&jp
1.16 ! takayama 396: CMO では ゼロの表現法がなんとおりもあることに注意.
! 397: %% どのようなゼロをうけとっても,
! 398: %% システムのゼロに変換できるべきである.
1.3 noro 399: */
400: /*&eg
1.12 takayama 401: Note that CMO has various representations of zero.
1.3 noro 402: */
1.1 noro 403:
404:
1.16 ! takayama 405: //&jp \subsection{ 整数 ZZ }
1.3 noro 406: //&eg \subsection{ Integer ZZ }
1.1 noro 407:
408: \begin{verbatim}
409: #define CMO_ZZ 20
410: \end{verbatim}
411:
1.3 noro 412: /*&jp
1.16 ! takayama 413: この節ではOpen xxx 規約における任意の大きさの整数(bignum)の扱いについ
! 414: て説明する. Open XM 規約における多重精度整数を表すデータ型 CMO\_ZZ は
! 415: GNU MPライブラリなどを参考にして設計されていて, 符号付き絶対値表現を用
! 416: いている. (cf. {\tt kan/sm1} の配布ディレクトリのなかの {\tt
! 417: plugin/cmo-gmp.c}) CMO\_ZZ は次の形式をとる.
1.3 noro 418: */
419: /*&eg
1.12 takayama 420: We describe the bignum (multi-precision integer) representation
421: {\tt CMO\_ZZ} in OpenXM.
422: The format is similar
1.3 noro 423: to that in GNU MP. (cf. {\tt plugin/cmo-gmp.c} in the {\tt kan/sm1}
424: distribution). CMO\_ZZ is defined as follows.
425: */
1.1 noro 426:
427: \begin{tabular}{|c|c|c|c|c|}
428: \hline
429: {\tt int32 CMO\_ZZ} & {\tt int32 $f$} & {\tt int32 $b_0$} & $\cdots$ &
430: {\tt int32 $b_{n}$} \\
431: \hline
1.3 noro 432: \end{tabular}
433:
434: /*&jp
1.16 ! takayama 435: $f$ は32bit整数である. $b_0, \ldots, b_n$ は unsigned int32 である.
! 436: $|f|$ は $n+1$ である. この CMO の符号は $f$ の符号で定める. 前述し
! 437: たように, 32bit整数の負数は 2 の補数表現で表される.
1.3 noro 438:
1.16 ! takayama 439: Open xxx 規約では上の CMO は以下の整数を意味する. ($R = 2^{32}$)
1.3 noro 440: */
441: /*&eg
442: $f$ is a 32bit integer. $b_0, \ldots, b_n$ are unsigned 32bit integers.
443: $|f|$ is equal to $n+1$.
1.12 takayama 444: The sign of $f$ represents that of the above integer to be expressed.
445: As stated in Section
1.3 noro 446: \ref{sec:basic0}, a negative 32bit integer is represented by
447: two's complement.
448:
449: In OpenXM the above CMO represents the following integer. ($R = 2^{32}$.)
450: */
1.1 noro 451:
452: \[
453: \mbox{sgn}(f)\times (b_0 R^{0}+ b_1 R^{1} + \cdots + b_{n-1}R^{n-1} + b_n R^n).
454: \]
1.3 noro 455:
456: /*&jp
1.16 ! takayama 457: \noindent 例:
! 458: {\tt int32} を network byte order で表現
! 459: しているとすると,例えば, 整数 $14$ は CMO\_ZZ で表わすと,
1.3 noro 460: */
461: /*&eg
1.12 takayama 462: \noindent Example:
1.3 noro 463: If we express {\tt int32} by the network byte order,
464: a CMO\_ZZ $14$ is expressed by
465: */
1.1 noro 466: \[
467: \mbox{(CMO\_ZZ, 1, 0, 0, 0, e)},
468: \]
1.16 ! takayama 469: //&jp と表わす. これはバイト列では
1.4 noro 470: //&eg The corresponding byte sequence is
1.1 noro 471: \[
472: \mbox{\tt 00 00 00 14 00 00 00 01 00 00 00 0e}
473: \]
1.16 ! takayama 474: //&jp となる.
1.1 noro 475:
476:
1.16 ! takayama 477: //&jp なお ZZ の 0 ( (ZZ) 0 と書く ) は, {\tt (CMO\_ZZ, 00,00,00,00)} と表現する.
1.3 noro 478: //&eg Note that CMO\_ZZ 0 is expressed by {\tt (CMO\_ZZ, 00,00,00,00)}.
1.1 noro 479:
480:
1.16 ! takayama 481: //&jp \subsection{ 分散表現多項式 Dpolynomial }
1.3 noro 482: //&eg \subsection{ Distributed polynomial Dpolynomial }
1.1 noro 483:
1.3 noro 484: /*&jp
1.16 ! takayama 485: 環とそれに属する多項式は次のような考えかたであつかう.
1.1 noro 486:
1.16 ! takayama 487: Generic DMS ring に属する元は,
! 488: 変数を $n$ 個持つ 適当な係数集合 $K$ を持つ多項式環 $K[x_1, \ldots, x_n]$
! 489: の元である.
! 490: 係数集合 $K$ がなにかは, 実際データを読み込み, Coefficient を見た段階で
! 491: わかる.
! 492: この環に属する多項式を CMO 形式でうけとった場合, 各サーバはその
! 493: サーバの対応する Object に変換しないといけない.
! 494: この変換の仕方は, 各サーバ毎にきめる.
! 495:
! 496: Asir の場合は, $K[x_1, \ldots, x_n]$ の元は分散表現多項式に変換される.
! 497: \noroa{ でも, order はどうなるの? }
! 498:
! 499: {\tt kan/sm1} の場合は事情は複雑である.
! 500: {\tt kan/sm1} は, Generic DMS ring にあたる クラスをもたない.
! 501: つまり, Default で存在する, $n$ 変数の分散表現多項式環は存在しないわけである.
! 502: したがって, {\tt kan/sm1} では, DMS of N variables が来た場合,
! 503: これを CurrentRing の元として読み込む. CurrentRing の変数の数が $n'$
! 504: で, $n' < n$ だと新しい多項式環を生成してデータを読み込む.
! 505: Order その他の optional 情報はすべて無視する.
! 506:
! 507: DMS の 2 番目のフィールドで,
! 508: Ring by Name を用いた場合, 現在の名前空間で変数 yyy に格納された ring object
! 509: の元として, この多項式を変換しなさいという意味になる.
! 510: {\tt kan/sm1} の場合, 環の定義は ring object として格納されており,
! 511: この ring object を 変数 yyy で参照することにより CMO としてうけとった
! 512: 多項式をこの ring の元として格納できる.
1.3 noro 513: */
1.1 noro 514:
1.3 noro 515: /*&eg
516: We treat polynomial rings and their elements as follows.
1.1 noro 517:
1.4 noro 518: Generic DMS ring is an $n$-variate polynomial ring $K[x_1, \ldots, x_n]$,
1.12 takayama 519: where $K$ is a coefficient set. $K$ is unknown in advance
1.4 noro 520: and it is determined when coefficients of an element are received.
521: When a server has received an element in Generic DMS ring,
1.3 noro 522: the server has to translate it into the corresponding local object
523: on the server. Each server has its own translation scheme.
524: In Asir such an element are translated into a distributed polynomial.
525: In {\tt kan/sm1} things are complicated.
1.4 noro 526: {\tt kan/sm1} does not have any class corresponding to Generic DMS ring.
1.3 noro 527: {\tt kan/sm1} translates a DMS of N variables into an element of
528: the CurrentRing.
529: If the CurrentRing is $n'$-variate and $n' < n$, then
1.12 takayama 530: an $n$-variate polynomial ring is newly created.
531:
1.3 noro 532:
1.4 noro 533: If RingByName ({\tt CMO\_RING\_BY\_NAME}, yyy)
1.3 noro 534: is specified as the second field of DMS,
535: it requests a sever to use a ring object whose name is yyy
536: as the destination ring for the translation.
537: */
1.1 noro 538:
539: \medbreak \noindent
1.16 ! takayama 540: //&jp {\bf Example}: (すべての数の表記は 16 進表記)
1.3 noro 541: //&eg {\bf Example}: (all numbers are represented in hexadecimal notation)
1.1 noro 542: {\footnotesize \begin{verbatim}
543: Z/11Z [6 variables]
544: (kxx/cmotest.sm1) run
545: [(x,y) ring_of_polynomials ( ) elimination_order 11 ] define_ring ;
546: (3x^2 y). cmo /ff set ;
547: [(cmoLispLike) 1] extension ;
548: ff ::
549: Class.CMO CMO StandardEncoding: size = 52, size/sizeof(int) = 13,
550: tag=CMO_DISTRIBUTED_POLYNOMIAL
551:
552: 0 0 0 1f 0 0 0 1 0 0 0 18 0 0 0 13 0 0 0 6
553: 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1
554: 0 0 0 0 0 0 0 2 0 0 0 3
555:
556: ff omc ::
557: (CMO_DISTRIBUTED_POLYNOMIAL[1f],[size=]1,(CMO_DMS_GENERIC[18],),
558: (CMO_MONOMIAL32[13],3*x^2*y),),
559: \end{verbatim} }
1.3 noro 560: /*&jp
1.16 ! takayama 561: $ 3 x^2 y$ は 6 変数の多項式環の 元としてみなされている.
1.3 noro 562: */
563: /*&eg
564: $3 x^2 y$ is regarded as an element of a six-variate polynomial ring.
565: */
1.1 noro 566:
567:
1.16 ! takayama 568: //&jp \subsection{再帰表現多項式の定義}
1.3 noro 569: //&eg \subsection{Recursive polynomials}
1.1 noro 570:
571: \begin{verbatim}
572: #define CMO_RECURSIVE_POLYNOMIAL 27
573: #define CMO_POLYNOMIAL_IN_ONE_VARIABLE 33
574: \end{verbatim}
575:
1.4 noro 576: Group CMObject/RecursivePolynomial requires CMObject/Primitive, CMObject/Basic.\\
1.1 noro 577: Polynomial in 1 variable, Coefficient, Name of the main variable,
578: Recursive Polynomial, Ring definition for recursive polynomials
579: $\in$ CMObject/RecursivePolynomial \\
580:
1.3 noro 581: /*&jp
1.1 noro 582: \begin{eqnarray*}
583: \mbox{Polynomial in 1 variable} &:&
584: \mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\
585: & & \quad \mbox{ Name of the main variable }, \\
1.12 takayama 586: & & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} ) \\
1.16 ! takayama 587: & & \mbox{ --- m はモノミアルの個数. } \\
! 588: & & \mbox{ --- e, Coefficieint はモノミアルを表現している. } \\
! 589: & & \mbox{ --- 順序の高い順にならべる. 普通は巾の高い順.} \\
! 590: & & \mbox{ --- e は 1変数多項式の巾をあらわす. } \\
1.1 noro 591: \mbox{Coefficient} &:& \mbox{ ZZ} \,|\, \mbox{ QQ } \,|\,
592: \mbox{ integer32 } \,|\,
593: \mbox{ Polynomial in 1 variable } \\
594: & & \quad \,|\, \mbox{Tree} \,|\, \mbox{Zero} \,|\,\mbox{Dpolynomial}\\
595: \mbox{Name of the main variable } &:&
596: \mbox{ {\sl int32} v } \\
1.16 ! takayama 597: & & \mbox{ --- v は 変数番号 (0 からはじまる) を表す. } \\
1.1 noro 598: \mbox{Recursive Polynomial} &:&
599: \mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\
1.3 noro 600: & & \quad \mbox{ RringDefinition, } \\
1.1 noro 601: & & \quad
1.12 takayama 602: \mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} ) \\
1.3 noro 603: \mbox{RringDefinition}
1.1 noro 604: & : & \mbox{ {\sl List} v } \\
1.16 ! takayama 605: & & \quad \mbox{ --- v は, 変数名(indeterminate) または Tree のリスト. } \\
! 606: & & \quad \mbox{ --- 順序の高い順. } \\
1.1 noro 607: \end{eqnarray*}
1.3 noro 608: */
609: /*&eg
610: \begin{eqnarray*}
611: \mbox{Polynomial in 1 variable} &:&
612: \mbox{({\tt CMO\_POLYNOMIAL\_IN\_ONE\_VARIABLE},\, {\sl int32}\, m, } \\
613: & & \quad \mbox{ Name of the main variable }, \\
1.12 takayama 614: & & \quad \mbox{ \{ {\sl int32} e, Coefficient \}} ) \\
1.4 noro 615: & & \mbox{ --- m is the number of monomials. } \\
616: & & \mbox{ --- A pair of e and Coefficient represents a monomial. } \\
1.3 noro 617: & & \mbox{ --- The pairs of e and Coefficient are sorted in the } \\
618: & & \mbox{ \quad decreasing order, usually with respect to e.} \\
619: & & \mbox{ --- e denotes an exponent of a monomial with respect to } \\
620: & & \mbox{ \quad the main variable. } \\
621: \mbox{Coefficient} &:& \mbox{ ZZ} \,|\, \mbox{ QQ } \,|\,
622: \mbox{ integer32 } \,|\,
623: \mbox{ Polynomial in 1 variable } \\
624: & & \quad \,|\, \mbox{Tree} \,|\, \mbox{Zero} \,|\,\mbox{Dpolynomial}\\
625: \mbox{Name of the main variable } &:&
626: \mbox{ {\sl int32} v } \\
627: & & \mbox{ --- v denotes a variable number. } \\
628: \mbox{Recursive Polynomial} &:&
629: \mbox{ ( {\tt CMO\_RECURSIVE\_POLYNOMIAL}, } \\
630: & & \quad \mbox{ RringDefinition, } \\
631: & & \quad
1.12 takayama 632: \mbox{ Polynomial in 1 variable}\, | \, \mbox{Coefficient} ) \\
1.3 noro 633: \mbox{RringDefinition}
634: & : & \mbox{ {\sl List} v } \\
1.10 takayama 635: & & \quad \mbox{ --- v is a list of names of indeterminates or trees. } \\
1.3 noro 636: & & \quad \mbox{ --- It is sorted in the decreasing order. } \\
637: \end{eqnarray*}
638: */
1.1 noro 639: \bigbreak
640: \noindent
1.3 noro 641: Example:
1.1 noro 642: \begin{verbatim}
643: (CMO_RECURSIEVE_POLYNOMIAL, ("x","y"),
644: (CMO_POLYNOMIAL_IN_ONE_VARIABLE, 2, 0, <--- "x"
645: 3, (CMO_POLYNOMIAL_IN_ONE_VARIABLE, 2, 1, <--- "y"
646: 5, 1234,
647: 0, 17),
648: 1, (CMO_POLYNOMIAL_IN_ONE_VARIABLE, 2, 1, <--- "y"
649: 10, 1,
650: 5, 31)))
651: \end{verbatim}
1.16 ! takayama 652: //&jp これは,
1.3 noro 653: //&eg This represents
654: $$ x^3 (1234 y^5 + 17 ) + x^1 (y^{10} + 31 y^5) $$
655: /*&jp
1.16 ! takayama 656: をあらわす.
! 657: %%非可換多項式もこの形式であらわしたいので, 積の順序を上のように
! 658: %%すること. つまり, 主変数かける係数の順番.
1.3 noro 659: */
660: /*&eg
1.12 takayama 661: %%We intend to represent non-commutative polynomials with the
662: %%same form. In such a case, the order of products are defined
663: %%as above, that is a power of the main variable $\times$ a coeffcient.
664:
1.3 noro 665: */
1.1 noro 666:
667: \noindent
668: \begin{verbatim}
669: sm1
670: sm1>(x^2-h). [(class) (recursivePolynomial)] dc /ff set ;
671: sm1>ff ::
672: Class.recursivePolynomial h * ((-1)) + (x^2 * (1))
673: \end{verbatim}
674:
1.16 ! takayama 675: //&jp \subsection{CPU依存の double }
1.3 noro 676: //&eg \subsection{CPU dependent double}
1.1 noro 677:
678: \begin{verbatim}
679: #define CMO_64BIT_MACHINE_DOUBLE 40
680: #define CMO_ARRAY_OF_64BIT_MACHINE_DOUBLE 41
681: #define CMO_128BIT_MACHINE_DOUBLE 42
682: #define CMO_ARRAY_OF_128BIT_MACHINE_DOUBLE 43
683: \end{verbatim}
684:
685: \noindent
1.4 noro 686: Group CMObject/MachineDouble requires CMObject/Primitive.\\
1.1 noro 687: 64bit machine double, Array of 64bit machine double
688: 128bit machine double, Array of 128bit machine double
689: $\in$ CMObject/MachineDouble \\
690:
1.3 noro 691: /*&jp
1.1 noro 692: \begin{eqnarray*}
693: \mbox{64bit machine double} &:&
694: \mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\
1.12 takayama 695: & & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\
1.16 ! takayama 696: & & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\
! 697: & & \mbox{ --- この表現はCPU依存である.}\\
! 698: && \mbox{\quad\quad byte order negotiation を用いる.} \\
1.1 noro 699: \mbox{Array of 64bit machine double} &:&
700: \mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\
701: & & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\
1.16 ! takayama 702: & & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の double (64bit) である. } \\
! 703: & & \mbox{ --- この表現はCPU依存である.}\\
! 704: & & \mbox{ \quad\quad byte order negotiation を用いる.} \\
1.1 noro 705: \mbox{128bit machine double} &:&
706: \mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\
1.12 takayama 707: & & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\
1.16 ! takayama 708: & & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\
! 709: & & \mbox{ --- この表現はCPU依存である.}\\
! 710: && \mbox{\quad\quad byte order negotiation を用いる.} \\
1.1 noro 711: \mbox{Array of 128bit machine double} &:&
712: \mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\
1.12 takayama 713: & & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\
1.16 ! takayama 714: & & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の long double (128bit) である. } \\
! 715: & & \mbox{ --- この表現はCPU依存である.}\\
! 716: & & \mbox{ \quad\quad byte order negotiation を用いる.}
1.1 noro 717: \end{eqnarray*}
1.3 noro 718: */
719: /*&eg
720: \begin{eqnarray*}
721: \mbox{64bit machine double} &:&
722: \mbox{({\tt CMO\_64BIT\_MACHINE\_DOUBLE}, } \\
1.12 takayama 723: & & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\
1.16 ! takayama 724: & & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\
1.12 takayama 725: & & \mbox{ --- Encoding depends on CPU.}\\
1.13 takayama 726: && \mbox{\quad\quad Need the byte order negotiation.} \\
1.3 noro 727: \mbox{Array of 64bit machine double} &:&
728: \mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\
729: & & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\
730: & & \mbox{ --- s*[1], $\ldots$ s*[m] are 64bit double's. } \\
1.12 takayama 731: & & \mbox{ --- Encoding depends on CPU.}\\
1.13 takayama 732: & & \mbox{\quad\quad Need the byte order negotiation.} \\
1.3 noro 733: \mbox{128bit machine double} &:&
734: \mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\
1.12 takayama 735: & & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\
1.16 ! takayama 736: & & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\
1.12 takayama 737: & & \mbox{ --- Encoding depends on CPU.}\\
1.13 takayama 738: & & \mbox{\quad\quad Need the byte order negotiation.} \\
1.3 noro 739: \mbox{Array of 128bit machine double} &:&
740: \mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\
1.12 takayama 741: & & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\
1.3 noro 742: & & \mbox{ --- s*[1], $\ldots$ s*[m] are 128bit long double's. } \\
1.12 takayama 743: & & \mbox{ --- Encoding depends on CPU.}\\
1.13 takayama 744: & & \mbox{\quad\quad Need the byte order negotiation.} \\
1.3 noro 745: \end{eqnarray*}
746: */
1.1 noro 747:
748: \bigbreak
1.12 takayama 749:
1.1 noro 750: \begin{verbatim}
751: #define CMO_IEEE_DOUBLE_FLOAT 51
752: \end{verbatim}
753:
1.3 noro 754: /*&jp
1.16 ! takayama 755: IEEE 準拠の float については, IEEE 754 double precision floating-point
! 756: format (64 bit) の定義を見よ.
1.13 takayama 757:
1.16 ! takayama 758: 256.100006 の Intel Pentium の double64 での内部表現は
1.13 takayama 759: {\tt cd 0c 80 43 } \\
1.16 ! takayama 760: 256.100006 の PowerPC (Mac) の double64 での内部表現は
1.13 takayama 761: {\tt 43 80 0c cd }.
1.16 ! takayama 762: この例でみるように byte の順序が逆である.
! 763: エンジンスタートの時の byte order negotiation で byte の順序を指定する.
1.13 takayama 764:
765:
1.3 noro 766: */
767: /*&eg
1.5 noro 768: See IEEE 754 double precision floating-point (64 bit) for the details of
1.12 takayama 769: float compliant to the IEEE standard.
1.13 takayama 770:
771: The internal expression of 256.100006 in the Intel Pentium is
772: {\tt cd 0c 80 43 } \\
773: The internal expression of 256.100006 in the PowerPC (Mac) is
774: {\tt 43 80 0c cd }.
775: As you have seen in this example,
776: the orders of the bytes are opposite each other.
777: The byte order is specified by the byte order negotiation protocol
778: when the engine starts.
779:
1.3 noro 780: */
1.1 noro 781:
1.15 takayama 782: \subsection{Bigfloat32}
783: /*&jp
1.16 ! takayama 784: int32 を基本とした bigfloat の表現方法について述べる.
! 785: この形式は mpfr を 32bit CPU で使用した時の内部表現と共通である.
1.15 takayama 786: */
787: /*&eg
788: This subsection describes our format for bigfloat in terms of the int32.
789: This format is identical to the internal format of mpfr on 32 bit CPU's.
790: */
791: Ref: {\tt OpenXM/src/mpfr/bfsize/bfsize.c}
792:
793: \begin{verbatim}
794: #define CMO_BIGFLOAT32 52
795: \end{verbatim}
796:
797:
798: /*&jp
1.16 ! takayama 799: Bigfloat32 は次の形式の int32 の配列である.
1.15 takayama 800: */
801: /*&eg
802: The bigfloat32 is an array of int32 numbers of the following format.
803: */
804:
805: \begin{center}
806: {\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp},
807: {\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]}
808: \end{center}
809:
810: /*&jp
1.16 ! takayama 811: p=prec は精度, s=sign は符号(1 が正の数, -1 (2の補数表現)が負の数) ,
! 812: E=exp は指数部で, 上のデータは数
1.15 takayama 813: $$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E $$
1.16 ! takayama 814: を表す.
! 815: ここで $B=2^{32}$,
1.15 takayama 816: $k = \lceil p/32 \rceil$
1.16 ! takayama 817: である.
1.15 takayama 818: */
819: /*&eg
820: p=prec is the precision, s=sign is the sign(1 means positive, -1 (expressed by two's complement) is nevative),
821: E=exp is the exponent, and the data above expresses the number
822: $$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E. $$
823: Here, $B=2^{32}$,
824: $k = \lceil p/32 \rceil$.
825: */
1.1 noro 826:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>