Skip to content

Commit 93529ea

Browse files
authored
Merge pull request #381 from Affonso-Gui/ratio-docs
Add extended-number doc add :init to complex number c.f #373
2 parents b096a02 + 22157a0 commit 93529ea

File tree

9 files changed

+54
-13
lines changed

9 files changed

+54
-13
lines changed

doc/jlatex/jarith.tex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,5 +317,22 @@ \subsection{基本関数}
317317

318318
\end{refdesc}
319319

320+
\subsection{拡張された数字}
321+
\begin{refdesc}
322+
323+
\classdesc{ratio}{extended-number}{(numerator denominator)}{
324+
有理数を記述する。}
325+
326+
\methoddesc{:init}{num denom}{
327+
有理数のインスタンスを、分子{\em num}分母{\em denom}として初期化する。}
328+
329+
\classdesc{complex}{extended-number}{(real imaginary)}{
330+
複素数を記述する。}
331+
332+
\methoddesc{:init}{re im}{
333+
複素数のインスタンスを、実部{\em re}虚部{\em im}として初期化する。}
334+
335+
\end{refdesc}
336+
320337
\newpage
321338

doc/jlatex/jgenerals.tex

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

3839
EusLispは、文字型を持たないため、文字列はintegerで表現される。
3940
文字コード表と無関係なプログラムを書くためには、

doc/jlatex/jintro.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ \subsection{Common Lispとの互換性}
142142
\item 多値変数:
143143
multiple-value-call, multiple-value-prog1, etc.
144144
\item いくつかのデータ型:
145-
complex number, bignum, ratio, character, deftype
145+
bignum, character, deftype
146146
\item いくつかの特殊書式:
147147
progv, compiler-let,macrolet
148148
\end{enumerate}

doc/jlatex/jmanual.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
\newcommand{\classdesc}[4]{ %class, super slots description
103103
\vspace{2mm}
104104
\index{#1}
105-
{\Large {\bf #1 }} \hfill [クラス] %super
105+
{\large {\bf #1 }} \hfill [クラス] %super
106106
\begin{tabbing}
107107
\hspace{30mm} :super \hspace{5mm} \= {\bf #2} \\
108108
\hspace{30mm} :slots \> #3

doc/latex/arith.tex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,21 @@ \subsection{Trigonometric and Related Functions}
321321

322322
\end{refdesc}
323323

324+
\subsection{Extended Numbers}
325+
\begin{refdesc}
326+
327+
\classdesc{ratio}{extended-number}{(numerator denominator)}{
328+
Describes rational numbers.}
329+
330+
\methoddesc{:init}{num denom}{
331+
initializes a rational number instance with numerator {\em num} and denominator {\em denom}.}
332+
333+
\classdesc{complex}{extended-number}{(real imaginary)}{
334+
Describes complex numbers.}
335+
336+
\methoddesc{:init}{re im}{
337+
initializes a complex number instance with real part {\em re} and imaginary part {\em im}.}
338+
339+
\end{refdesc}
340+
324341
\newpage

doc/latex/intro.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ \subsection{Compatibility with Common Lisp}
218218
multiple-value-call,multiple-value-prog1, etc., are present only
219219
in a limited way;
220220
\item some of data types:
221-
complex number, bignum, character, deftype and ratio (this last
222-
one is present only in a limited way as well);
221+
bignum, character, deftype, complex number and ratio (the last
222+
two are present only in a limited way);
223223
\item some of special forms:
224224
progv, compiler-let,macrolet
225225
\end{enumerate}

doc/latex/manual.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
\newcommand{\classdesc}[4]{ %class, super slots description
108108
\vspace{2mm}
109109
\index{#1}
110-
{\Large {\bf #1 }} \hfill [class] %super
110+
{\large {\bf #1 }} \hfill [class] %super
111111
\begin{tabbing}
112112
\hspace{30mm} :super \hspace{5mm} \= {\bf #2} \\
113113
\hspace{30mm} :slots \> #3

doc/latex/types.tex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ \section{Data Types}
55
Any variable can have any object as its value.
66
Of course, it is possible to
77
declare the type of object which is bound to a variable, but in many cases
8-
it is only advisary information to the compiler to generate faster code.
8+
it is only advisory information to the compiler to generate faster code.
99
In EusLisp, it needs to distinguish pointers and objects.
1010
Numbers are immediately represented by pointers and all the others
11-
are represented by ojbects referenced by pointers.
11+
are represented by objects referenced by pointers.
1212

1313
\subsection{Numbers}
1414

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

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

2829
EusLisp does not have the character type,
2930
and characters are represented by integers.

lisp/l/extnum.l

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
(:init (num denom)
33
(setq numerator num
44
denominator denom)
5-
self)
6-
)
5+
self))
6+
7+
(defmethod complex
8+
(:init (re im)
9+
(setq real re
10+
imaginary im)
11+
self))

0 commit comments

Comments
 (0)