Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/jlatex/jarith.tex
Original file line number Diff line number Diff line change
Expand Up @@ -317,5 +317,22 @@ \subsection{基本関数}

\end{refdesc}

\subsection{拡張された数字}
\begin{refdesc}

\classdesc{ratio}{extended-number}{(numerator denominator)}{
有理数を記述する。}

\methoddesc{:init}{num denom}{
有理数のインスタンスを、分子{\em num}分母{\em denom}として初期化する。}

\classdesc{complex}{extended-number}{(real imaginary)}{
複素数を記述する。}

\methoddesc{:init}{re im}{
複素数のインスタンスを、実部{\em re}虚部{\em im}として初期化する。}

\end{refdesc}

\newpage

1 change: 1 addition & 0 deletions doc/jlatex/jgenerals.tex
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ \subsection{数値}
しかしながら、数値は決してヒープメモリを無駄にすることがないため、
数値を扱うアプリケーションでは、ガーベージコレクション
の原因とならず有効に動作する。
有理数や複素数など、別の数字の型はEusLispのオブジェクトとして記述される。

EusLispは、文字型を持たないため、文字列はintegerで表現される。
文字コード表と無関係なプログラムを書くためには、
Expand Down
2 changes: 1 addition & 1 deletion doc/jlatex/jintro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ \subsection{Common Lispとの互換性}
\item 多値変数:
multiple-value-call, multiple-value-prog1, etc.
\item いくつかのデータ型:
complex number, bignum, ratio, character, deftype
bignum, character, deftype
\item いくつかの特殊書式:
progv, compiler-let,macrolet
\end{enumerate}
Expand Down
2 changes: 1 addition & 1 deletion doc/jlatex/jmanual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
\newcommand{\classdesc}[4]{ %class, super slots description
\vspace{2mm}
\index{#1}
{\Large {\bf #1 }} \hfill [クラス] %super
{\large {\bf #1 }} \hfill [クラス] %super
\begin{tabbing}
\hspace{30mm} :super \hspace{5mm} \= {\bf #2} \\
\hspace{30mm} :slots \> #3
Expand Down
17 changes: 17 additions & 0 deletions doc/latex/arith.tex
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,21 @@ \subsection{Trigonometric and Related Functions}

\end{refdesc}

\subsection{Extended Numbers}
\begin{refdesc}

\classdesc{ratio}{extended-number}{(numerator denominator)}{
Describes rational numbers.}

\methoddesc{:init}{num denom}{
initializes a rational number instance with numerator {\em num} and denominator {\em denom}.}

\classdesc{complex}{extended-number}{(real imaginary)}{
Describes complex numbers.}

\methoddesc{:init}{re im}{
initializes a complex number instance with real part {\em re} and imaginary part {\em im}.}

\end{refdesc}

\newpage
4 changes: 2 additions & 2 deletions doc/latex/intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ \subsection{Compatibility with Common Lisp}
multiple-value-call,multiple-value-prog1, etc., are present only
in a limited way;
\item some of data types:
complex number, bignum, character, deftype and ratio (this last
one is present only in a limited way as well);
bignum, character, deftype, complex number and ratio (the last
two are present only in a limited way);
\item some of special forms:
progv, compiler-let,macrolet
\end{enumerate}
Expand Down
2 changes: 1 addition & 1 deletion doc/latex/manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
\newcommand{\classdesc}[4]{ %class, super slots description
\vspace{2mm}
\index{#1}
{\Large {\bf #1 }} \hfill [class] %super
{\large {\bf #1 }} \hfill [class] %super
\begin{tabbing}
\hspace{30mm} :super \hspace{5mm} \= {\bf #2} \\
\hspace{30mm} :slots \> #3
Expand Down
13 changes: 7 additions & 6 deletions doc/latex/types.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ \section{Data Types}
Any variable can have any object as its value.
Of course, it is possible to
declare the type of object which is bound to a variable, but in many cases
it is only advisary information to the compiler to generate faster code.
it is only advisory information to the compiler to generate faster code.
In EusLisp, it needs to distinguish pointers and objects.
Numbers are immediately represented by pointers and all the others
are represented by ojbects referenced by pointers.
are represented by objects referenced by pointers.

\subsection{Numbers}

There are two kinds of numbers, that is,
integer and float (floating-point number), both are represented
with 29 bits value and 1 bit sign.
Thus, intergers range from -536,870,912 to 536,870,911.
Floatings can represent plus/minus from 4.8E-38 to 3.8E38 with the
Thus, integers range from -536,870,912 to 536,870,911.
Floats can represent plus/minus from 4.8E-38 to 3.8E38 with the
approximate accuracy of 6 digits in decimal, i.e.,
floating-point epsilon is about 1/1,000,000.

Numbers are always represented by pointers, and not by objects,
this is the only exception of EusLisp's object orientation.
Integer and float numbers are always represented by pointers, and not by objects,
which is the only exception of EusLisp's object orientation.
However, since numbers never waste heap memory, number crunching application
runs efficiently without causing garbage collection.
Other number types such as ratio and complex numbers are normal EusLisp objects.

EusLisp does not have the character type,
and characters are represented by integers.
Expand Down
9 changes: 7 additions & 2 deletions lisp/l/extnum.l
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
(:init (num denom)
(setq numerator num
denominator denom)
self)
)
self))

(defmethod complex
(:init (re im)
(setq real re
imaginary im)
self))