Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Standard Functions/ja: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
111F - 標準関数 (著者: Tao Yue, 状態: 原文のまま)
22
33Pascal には利用可能な標準的数学関数がいくつか用意されている。 たとえば、パイ(π)のsinの値を求めるのは以下のようになる。
44
55``` pascal
66value := sin (3.1415926535897932);
77```
88
99sin関数は3角法のすべての関数がそうであるように、ラジアンで表現される角度に適用できることに注意しよう。問題がなければ、値は0になるはずである。
1010
1111関数は関数名のあとにカッコで引数をつけて呼び出される。標準の Pascal 関数には以下のものが含まれる。
1212
1313| Function | Description | Argument type | Return type |
1414|----|----|----|----|
1515| abs | 絶対値 | real or integer | 引数と同じ型 |
1616| arctan | ラジアンでのアークタンジェント(arctan) | real or integer | real |
1717| cos | ラジアンでコサイン(cosine) | real or integer | real |
1818| exp | 指数(e to the given power) | real or integer | real |
1919| ln | 自然対数 | real or integer | real |
2020| round | もっと近い整数への丸め | real | integer |
2121| sin | ラジアンでのサイン(sin) | real or integer | real |
2222| sqr | 二乗 (指数 2) | real or integer | 引数と同じ型 |
2323| sqrt | 平方根 (指数 1/2) | real or integer | real |
2424| trunc | 端数の切り捨て | real or integer | integer |
2525
2626順序型データタイプ(integer or char)は、その前後に明らかな値を持ち、次のような関数が利用できる。
2727
2828| Function | Description | Argument type | Return type |
2929|----------|----------------------|-----------------|--------------|
3030| chr | ASCII 値で表した文字 | integer | char |
3131| ord | 順序値 | integer or char | integer |
3232| pred | 前の値 | integer or char | 引数と同じ型 |
3333| succ | 後の値 | integer or char | 引数と同じ型 |
3434
3535実数は順序型データタイプではない。なぜなら前後に明らかな値をもっていないからである。56.0の次の値は何だろうか? 56.1だろうか、あるいは56.01、56.001、それとも56.0001だろうか?
3636
3737しかし、整数の56に対しては明らかな前の値55と明らかな次の値57が存在している。
3838
3939同じことが文字にも言える。
4040
41-```
41+```text
4242 'b'
4343 次の文字: 'c'
4444 前の文字: 'a'
4545```
4646
4747上に挙げたのは完全なリストではない。現在の Pascal コンパイラはあらゆる種類の目的のために数千もの関数を含んでいるのである。さらに知りたければ自分のコンパイラの資料をチェックすると良い。
4848
4949| | | |
5050|----|----|----|
5151| [[Basic Pascal Tutorial/Chapter 1/Assignment and Operations/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 1/Punctuation and Indentation/ja|next]] |
5252
5353---
5454*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Standard Functions/ja", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history