version 1.12, 2002/01/20 09:26:21 |
version 1.15, 2016/08/22 05:38:27 |
|
|
%% $OpenXM: OpenXM/doc/OpenXM-specs/cmo-basic1.tex,v 1.11 2001/08/27 05:39:15 takayama Exp $ |
%% $OpenXM: OpenXM/doc/OpenXM-specs/cmo-basic1.tex,v 1.14 2015/08/18 02:54:05 noro Exp $ |
//&jp \section{ 数, 多項式 の CMO 表現 } |
//&jp \section{ 数, 多項式 の CMO 表現 } |
//&eg \section{ CMOexpressions for numbers and polynomials } |
//&eg \section{ CMOexpressions for numbers and polynomials } |
\label{sec:basic1} |
\label{sec:basic1} |
|
|
#define CMO_RING_BY_NAME 26 |
#define CMO_RING_BY_NAME 26 |
#define CMO_DISTRIBUTED_POLYNOMIAL 31 |
#define CMO_DISTRIBUTED_POLYNOMIAL 31 |
#define CMO_RATIONAL 34 |
#define CMO_RATIONAL 34 |
|
#define CMO_COMPLEX 35 |
|
|
|
#define CMO_BIGFLOAT32 52 |
|
|
#define CMO_INDETERMINATE 60 |
#define CMO_INDETERMINATE 60 |
#define CMO_TREE 61 |
#define CMO_TREE 61 |
Line 72 ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/B |
|
Line 74 ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/B |
|
& & \mbox{ --- 有理数 $a/b$ を表す. } \\ |
& & \mbox{ --- 有理数 $a/b$ を表す. } \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
& & \mbox{ --- $a/b$ を表す. } \\ |
& & \mbox{ --- $a/b$ を表す. } \\ |
|
\mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32}, |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\ |
|
&:& \mbox{ --- bigfloat をあらわす. a[i], k についてはあとで説明}\\ |
|
\mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\ |
|
& & \mbox{ --- $a+b\sqrt{-1}$ を表す. } \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
& & \mbox{ --- 変数名 $v$ . } \\ |
& & \mbox{ --- 変数名 $v$ . } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
Line 96 ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/B |
|
Line 104 ZZ, QQ, Zero, Rational, Indeterminate $\in$ CMObject/B |
|
& & \mbox{ --- Rational number $a/b$. } \\ |
& & \mbox{ --- Rational number $a/b$. } \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
\mbox{Rational} &:& ({\tt CMO\_RATIONAL}, {\sl CMObject}\, {\rm a}, {\sl CMObject}\, {\rm b}) \\ |
& & \mbox{ --- Rational expression $a/b$. } \\ |
& & \mbox{ --- Rational expression $a/b$. } \\ |
|
\mbox{Bigfloat32} &:& ({\tt CMO\_BIGFLOAT32}, |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} ) \\ |
|
&:& \mbox{ --- bigfloat. The meaning of a[i], k will be explained later.}\\ |
|
\mbox{Complex} &:& ({\tt CMO\_COMPLEX}, {\sl CMObject}\, {\rm re}, {\sl CMObject}\, {\rm im}) \\ |
|
& & \mbox{ --- Complex number $a+b\sqrt{-1}$. } \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
\mbox{Indeterminate} &:& ({\tt CMO\_INDETERMINATE}, {\sl Cstring}\, {\rm v}) \\ |
& & \mbox{ --- Variable name $v$ . } \\ |
& & \mbox{ --- Variable name $v$ . } \\ |
\end{eqnarray*} |
\end{eqnarray*} |
Line 681 $\in$ CMObject/MachineDouble \\ |
|
Line 695 $\in$ CMObject/MachineDouble \\ |
|
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
&& \mbox{\quad\quad mathcap に CPU 情報を付加しておく.} \\ |
&& \mbox{\quad\quad byte order negotiation を用いる.} \\ |
\mbox{Array of 64bit machine double} &:& |
\mbox{Array of 64bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の double (64bit) である. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の double (64bit) である. } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ \quad\quad mathcap に CPU 情報を付加しておく.} \\ |
& & \mbox{ \quad\quad byte order negotiation を用いる.} \\ |
\mbox{128bit machine double} &:& |
\mbox{128bit machine double} &:& |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
&& \mbox{\quad\quad mathcap に CPU 情報を付加しておく.} \\ |
&& \mbox{\quad\quad byte order negotiation を用いる.} \\ |
\mbox{Array of 128bit machine double} &:& |
\mbox{Array of 128bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の long double (128bit) である. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] は m 個の long double (128bit) である. } \\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ --- この表現はCPU依存である.}\\ |
& & \mbox{ \quad\quad mathcap に CPU 情報を付加しておく.} |
& & \mbox{ \quad\quad byte order negotiation を用いる.} |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
/*&eg |
/*&eg |
Line 709 $\in$ CMObject/MachineDouble \\ |
|
Line 723 $\in$ CMObject/MachineDouble \\ |
|
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s8})\\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s8 は {\tt double} (64bit). } \\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
&& \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
&& \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{Array of 64bit machine double} &:& |
\mbox{Array of 64bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_64BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte}}\, s8[1], \ldots , {\sl byte}\, s8[m])\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 64bit double's. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 64bit double's. } \\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{128bit machine double} &:& |
\mbox{128bit machine double} &:& |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
\mbox{({\tt CMO\_128BIT\_MACHINE\_DOUBLE}, } \\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \quad \mbox{ {\sl byte} s1 , \ldots , {\sl byte} s16})\\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- s1, $\ldots$, s16 は {\tt long double} (128bit). } \\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\mbox{Array of 128bit machine double} &:& |
\mbox{Array of 128bit machine double} &:& |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
\mbox{({\tt CMO\_ARRAY\_OF\_128BIT\_MACHINE\_DOUBLE}, {\sl int32} m, } \\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \quad \mbox{ {\sl byte} s1[1] , \ldots , {\sl byte} s16[1], \ldots , {\sl byte} s16[m]})\\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 128bit long double's. } \\ |
& & \mbox{ --- s*[1], $\ldots$ s*[m] are 128bit long double's. } \\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{ --- Encoding depends on CPU.}\\ |
& & \mbox{\quad\quad Add informations on CPU to the mathcap.} \\ |
& & \mbox{\quad\quad Need the byte order negotiation.} \\ |
\end{eqnarray*} |
\end{eqnarray*} |
*/ |
*/ |
|
|
\bigbreak |
\bigbreak |
|
|
\begin{verbatim} |
\begin{verbatim} |
#define CMO_BIGFLOAT 50 |
|
#define CMO_IEEE_DOUBLE_FLOAT 51 |
#define CMO_IEEE_DOUBLE_FLOAT 51 |
\end{verbatim} |
\end{verbatim} |
|
|
/*&jp |
/*&jp |
IEEE 準拠の float については, IEEE 754 double precision floating-point |
IEEE 準拠の float については, IEEE 754 double precision floating-point |
format (64 bit) の定義を見よ. |
format (64 bit) の定義を見よ. |
|
|
|
256.100006 の Intel Pentium の double64 での内部表現は |
|
{\tt cd 0c 80 43 } \\ |
|
256.100006 の PowerPC (Mac) の double64 での内部表現は |
|
{\tt 43 80 0c cd }. |
|
この例でみるように byte の順序が逆である. |
|
エンジンスタートの時の byte order negotiation で byte の順序を指定する. |
|
|
|
|
*/ |
*/ |
/*&eg |
/*&eg |
See IEEE 754 double precision floating-point (64 bit) for the details of |
See IEEE 754 double precision floating-point (64 bit) for the details of |
float compliant to the IEEE standard. |
float compliant to the IEEE standard. |
|
|
|
The internal expression of 256.100006 in the Intel Pentium is |
|
{\tt cd 0c 80 43 } \\ |
|
The internal expression of 256.100006 in the PowerPC (Mac) is |
|
{\tt 43 80 0c cd }. |
|
As you have seen in this example, |
|
the orders of the bytes are opposite each other. |
|
The byte order is specified by the byte order negotiation protocol |
|
when the engine starts. |
|
|
*/ |
*/ |
|
|
\noindent |
\subsection{Bigfloat32} |
Group CMObject/Bigfloat requires CMObject/Primitive, CMObject/Basic.\\ |
/*&jp |
Bigfloat |
int32 を基本とした bigfloat の表現方法について述べる. |
$\in$ CMObject/Bigfloat \\ |
この形式は mpfr を 32bit CPU で使用した時の内部表現と共通である. |
|
*/ |
|
/*&eg |
|
This subsection describes our format for bigfloat in terms of the int32. |
|
This format is identical to the internal format of mpfr on 32 bit CPU's. |
|
*/ |
|
Ref: {\tt OpenXM/src/mpfr/bfsize/bfsize.c} |
|
|
\begin{eqnarray*} |
\begin{verbatim} |
\mbox{Bigfloat} &:& |
#define CMO_BIGFLOAT32 52 |
\mbox{({\tt CMO\_BIGFLOAT}, } \\ |
\end{verbatim} |
& & \quad \mbox{ {\sl ZZ} a , {\sl ZZ} e})\\ |
|
& & \mbox{ --- $a \times 2^e$. } \\ |
|
\end{eqnarray*} |
/*&jp |
|
Bigfloat32 は次の形式の int32 の配列である. |
|
*/ |
|
/*&eg |
|
The bigfloat32 is an array of int32 numbers of the following format. |
|
*/ |
|
|
|
\begin{center} |
|
{\sl int32}\, {\rm prec}, {\sl int32}\, {\rm sign}, {\sl int32}\, {\rm exp}, |
|
{\sl int32}\, \mbox{a[1]}, \ldots , {\sl int32}\, \mbox{a[k]} |
|
\end{center} |
|
|
|
/*&jp |
|
p=prec は精度, s=sign は符号(1 が正の数, -1 (2の補数表現)が負の数) , |
|
E=exp は指数部で, 上のデータは数 |
|
$$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E $$ |
|
を表す. |
|
ここで $B=2^{32}$, |
|
$k = \lceil p/32 \rceil$ |
|
である. |
|
*/ |
|
/*&eg |
|
p=prec is the precision, s=sign is the sign(1 means positive, -1 (expressed by two's complement) is nevative), |
|
E=exp is the exponent, and the data above expresses the number |
|
$$ s (a[k]/B + a[k-1]/B^2 + ... + a[1]/B^k) 2^E. $$ |
|
Here, $B=2^{32}$, |
|
$k = \lceil p/32 \rceil$. |
|
*/ |
|
|