Annotation of OpenXM/src/asir-doc/parts/builtin/type.texi, Revision 1.2
1.2 ! noro 1: @comment $OpenXM$
! 2: \BJP
1.1 noro 3: @node $B7?$r5a$a$kH!?t(B,,, $BAH$_9~$_H!?t(B
4: @section $B7?$r5a$a$kH!?t(B
1.2 ! noro 5: \E
! 6: \BEG
! 7: @node Types,,, Built-in Function
! 8: @section Types
! 9: \E
1.1 noro 10:
11: @menu
12: * type::
13: * ntype::
14: * vtype::
15: @end menu
16:
1.2 ! noro 17: \JP @node type,,, $B7?$r5a$a$kH!?t(B
! 18: \EG @node type,,, Types
1.1 noro 19: @subsection @code{type}
20: @findex type
21:
22: @table @t
23: @item type(@var{obj})
1.2 ! noro 24: \JP :: @var{obj} $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
! 25: \EG :: Returns an integer which identifies the type of the object @var{obj} in question.
1.1 noro 26: @end table
27:
28: @table @var
29: @item return
1.2 ! noro 30: \JP $B@0?t(B
! 31: \EG integer
1.1 noro 32: @item obj
1.2 ! noro 33: \JP $BG$0U(B
! 34: \EG arbitrary
1.1 noro 35: @end table
36:
37: @itemize @bullet
1.2 ! noro 38: \BJP
1.1 noro 39: @item
40: @var{obj} $B$N(B $B7?$NCM$O<!$NDL$j(B.
41: @table @t
42: @item 0
43: 0
44: @item 1
45: $B?t(B
46: @item 2
47: $BB?9`<0(B ($B?t$G$J$$(B)
48: @item 3
49: $BM-M}<0(B ($BB?9`<0$G$J$$(B)
50: @item 4
51: $B%j%9%H(B
52: @item 5
53: $B%Y%/%H%k(B
54: @item 6
55: $B9TNs(B
56: @item 7
57: $BJ8;zNs(B
58: @item 8
59: $B9=B$BN(B
60: @item 9
61: $BJ,;6I=8=B?9`<0(B
1.2 ! noro 62: @item 10
! 63: 32bit $BId9f$J$7@0?t(B
! 64: @item 11
! 65: $B%(%i!<%*%V%8%'%/%H(B
! 66: @item 12
! 67: GF(2) $B>e$N9TNs(B
! 68: @item 13
! 69: MATHCAP $B%*%V%8%'%/%H(B
! 70: @item 14
! 71: $B0l3,=R8lO@M}<0(B
! 72: @item -1
! 73: VOID $B%*%V%8%'%/%H(B
1.1 noro 74: @end table
75: @item
76: $B?t$N7?$r5a$a$k$K$O(B, @code{ntype} $B$rMQ$$$k(B.
77: $BITDj85$N7?$r5a$a$k$K$O(B, @code{vtype} $B$rMQ$$$k(B.
1.2 ! noro 78: \E
! 79: \BEG
! 80: @item
! 81: Current assignment of integers for object types is listed below.
! 82: @table @t
! 83: @item 0
! 84: 0
! 85: @item 1
! 86: number
! 87: @item 2
! 88: polynomial (not number)
! 89: @item 3
! 90: rational expression (not polynomial)
! 91: @item 4
! 92: list
! 93: @item 5
! 94: vector
! 95: @item 6
! 96: matrix
! 97: @item 7
! 98: string
! 99: @item 8
! 100: structure
! 101: @item 9
! 102: distributed polynomial
! 103: @item 10
! 104: 32bit unsigned integer
! 105: @item 11
! 106: error object
! 107: @item 12
! 108: matrix over GF(2)
! 109: @item 13
! 110: MATHCAP object
! 111: @item 14
! 112: first order formula
! 113: @item -1
! 114: VOID object
! 115: @end table
! 116: @item
! 117: For further classification of @var{number}, use @code{ntype()}.
! 118: For further classification of @var{variable}, use @code{vtype()}.
! 119: \E
1.1 noro 120: @end itemize
121:
122: @table @t
1.2 ! noro 123: \JP @item $B;2>H(B
! 124: \EG @item References
1.1 noro 125: @fref{ntype}, @fref{vtype}.
126: @end table
127:
1.2 ! noro 128: \JP @node ntype,,, $B7?$r5a$a$kH!?t(B
! 129: \EG @node ntype,,, Types
1.1 noro 130: @subsection @code{ntype}
131: @findex ntype
132:
133: @table @t
134: @item ntype(@var{num})
1.2 ! noro 135: \JP :: @var{num} ($B?t(B) $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
! 136: \EG :: Classifier of type @var{num}. Returns a sub-type number, an integer, for @var{obj}.
1.1 noro 137: @end table
138:
139: @table @var
140: @item return
1.2 ! noro 141: \JP $B<+A3?t(B
! 142: \EG integer
1.1 noro 143: @item obj
1.2 ! noro 144: \JP $B?t(B
! 145: \EG number
1.1 noro 146: @end table
147:
148: @itemize @bullet
1.2 ! noro 149: \BJP
1.1 noro 150: @item
151: $B?t$N7?$NCM$O<!$NDL$j(B.
152: @table @t
153: @item 0
154: $BM-M}?t(B
155: @item 1
156: $BG\@:EYIbF0>.?t(B
157: @item 2
158: $BBe?tE*?t(B
159: @item 3
160: $BG$0U@:EYIbF0>.?t(B (@b{bigfloat})
161: @item 4
162: $BJ#AG?t(B
163: @item 5
164: $BM-8BBN$N85(B
1.2 ! noro 165: @item 6
! 166: $BBgI8?tAGBN$N85(B
! 167: @item 7
! 168: $BI8?t(B 2 $B$NM-8BBN$N85(B
1.1 noro 169: @end table
170: @item
171: @code{newalg(x^2+1)} $B$G@8@.$7$??t$H(B, $B5u?tC10L(B @code{@@i} $B$O(B,
172: $B0[$J$k$b$N$H$7$F07$o$l$k(B.
173: @item
174: $BBe?tE*?t$K4X$7$F$O(B, @xref{$BBe?tE*?t$K4X$9$k1i;;(B}.
1.2 ! noro 175: \E
! 176: \BEG
! 177: @item
! 178: Sub-types for type number are listed below.
! 179: @table @t
! 180: @item 0
! 181: rational number
! 182: @item 1
! 183: floating double (double precision floating point number)
! 184: @item 2
! 185: algebraic number over rational number field
! 186: @item 3
! 187: arbitrary precision floating point number (@b{bigfloat})
! 188: @item 4
! 189: complex number
! 190: @item 5
! 191: element of a finite field
! 192: @item 6
! 193: element of a large finite prime field
! 194: @item 7
! 195: element of a finite field of characteristic 2
! 196: @end table
! 197: @item
! 198: When arithmetic operations for numbers are performed,
! 199: type coercion will be taken if their number sub-types are different
! 200: so that the object having smaller sub-type number will be transformed
! 201: to match the other object, except for algebraic numbers.
! 202: @item
! 203: A number object created by @code{newalg(x^2+1)} and the unit of
! 204: imaginary number @code{@@i} have different number sub-types, and
! 205: it is treated independently.
! 206: @item
! 207: @xref{Algebraic numbers} for algebraic numbers.
! 208: \E
1.1 noro 209: @end itemize
210:
211: @example
212: [0] [10/37,ntype(10/37)];
213: [10/37,0]
214: [1] [10.0/37.0,ntype(10.0/37.0)];
215: [0.27027,1]
216: [2] [newalg(x^2+1)+1,ntype(newalg(x^2+1)+1)];
217: [(#0+1),2]
218: [3] [eval(sin(@@pi/6)),ntype(eval(sin(@@pi/6)))];
219: [0.49999999999999999991,3]
220: [4] [@@i+1,ntype(@@i+1)];
221: [(1+1*@@i),4]
222: @end example
223:
224: @table @t
1.2 ! noro 225: \JP @item $B;2>H(B
! 226: \EG @item References
1.1 noro 227: @fref{type}.
228: @end table
229:
1.2 ! noro 230: \JP @node vtype,,, $B7?$r5a$a$kH!?t(B
! 231: \EG @node vtype,,, Types
1.1 noro 232: @subsection @code{vtype}
233: @findex vtype
234:
235: @table @t
236: @item vtype(@var{var})
1.2 ! noro 237: \JP :: @var{var} ($BITDj85(B) $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
! 238: \EG :: Type of indetarminates @var{var}.
1.1 noro 239: @end table
240:
241: @table @var
242: @item return
1.2 ! noro 243: \JP $B@0?t(B
! 244: \EG integer
1.1 noro 245: @item var
1.2 ! noro 246: \JP $BITDj85(B
! 247: \EG indeterminate
1.1 noro 248: @end table
249:
250: @itemize @bullet
1.2 ! noro 251: \BJP
1.1 noro 252: @item
253: @var{var} ($BITDj85(B) $B$N7?$NCM$O<!$NDL$j(B. $B>\:Y$O(B @xref{$BITDj85$N7?(B}.
254: @table @t
255: @item 0
256: $B0lHLITDj85(B (a,b,x,afo,bfo,...,etc)
257: @item 1
258: @code{uc()} $B$G@8@.$5$l$?ITDj85(B (@code{_0}, @code{_1}, @code{_2}, ... etc)
259: @item 2
260: $BH!?t7A<0(B (@code{sin(x)}, @code{log(a+1)}, @code{acosh(1)}, @code{@@pi}, @code{@@e}, ... etc)
261: @item 3
262: $BH!?t;R(B ($BAH$_9~$_H!?t;R(B, $B%f!<%6Dj5AH!?t;R(B, $B=iEyH!?t;R(B : @code{sin}, @code{log}, ... etc)
263: @end table
264: @item
265: @code{a();} $B$r<B9T(B($BDL>o$G$O%(%i!<(B)$B$7$?$@$1$G$b(B @code{ntype(a)} $B$O(B 3 $B$H$J$k(B.
266: $B$9$J$o$A(B @code{a} $B$O%f!<%6Dj5AH!?t;R$H$_$J$5$l$k(B.
267: @item
268: @code{@@pi}, @code{@@e} $B$OITDj85$H$7$F07$o$l$k$,(B, @code{eval()}, @code{pari()}
269: $B$K$*$$$F$O?t$H$7$F07$o$l$k(B.
1.2 ! noro 270: \E
! 271: \BEG
! 272: @item
! 273: Classify indeterminates into sub-types by giving an integer value as follows.
! 274: For details @xref{Types of indeterminates}.
! 275: @table @t
! 276: @item 0
! 277: ordinary indeterminate, which can be directly typed in on a keyboard
! 278: (a,b,x,afo,bfo,...,etc.)
! 279: @item 1
! 280: Special indeterminate, created by @code{uc()}
! 281: (@code{_0}, @code{_1}, @code{_2}, ... etc.)
! 282: @item 2
! 283: function form (@code{sin(x)}, @code{log(a+1)}, @code{acosh(1)}, @code{@@pi}, @code{@@e}, ... etc.)
! 284: @item 3
! 285: functor (built-in functor name, user defined functor, functor for
! 286: the elementary functions)
! 287: : @code{sin}, @code{log}, ... etc)
! 288: @end table
! 289: @item
! 290: Note: An input `@code{a();}' will cause an error, but it changes
! 291: the system database for identifiers. After this error, you will find
! 292: `@code{vtype(a)}' will result 3. (Identifier @code{a} is registered as
! 293: a user defined functor).
! 294: @item
! 295: Usually @code{@@pi} and @code{@@e} are treated as indeterminates,
! 296: whereas they are treated as numbers within functions @code{eval()} and
! 297: @code{pari()}.
! 298: \E
1.1 noro 299: @end itemize
300:
301: @table @t
1.2 ! noro 302: \JP @item $B;2>H(B
! 303: \EG @item References
1.1 noro 304: @fref{type}, @fref{ntype}, @fref{uc}.
305: @end table
306:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>