Difference between revisions of "Basic Pascal Tutorial/Chapter 1/Standard Functions/ja"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{Standard_Functions}} 1F - 標準関数 (著者: Tao Yue, 状態: 原文のまま) Pascal には利用可能な標準的数学関数がいくつか用意されている。F...")
 
Line 3: Line 3:
 
1F - 標準関数 (著者: Tao Yue, 状態: 原文のまま)
 
1F - 標準関数 (著者: Tao Yue, 状態: 原文のまま)
  
Pascal には利用可能な標準的数学関数がいくつか用意されている。For example, to find the value of sin of pi radians:
+
Pascal には利用可能な標準的数学関数がいくつか用意されている。
 +
たとえば、πのsinの値を求めるのは以下のようになる。
 
<syntaxhighlight>
 
<syntaxhighlight>
 
value := sin (3.1415926535897932);
 
value := sin (3.1415926535897932);
 
</syntaxhighlight>
 
</syntaxhighlight>
Note that the sin function operates on angular measure stated in radians, as do all the trigonometric functions. If everything goes well, value should become 0.
+
sin関数は3角法のすべての関数がそうであるように、ラジアンで表現される角度に適用できることに注意しよう。問題がなければ、値は0になるはずである。
  
Functions are called by using the function name followed by the argument(s) in parentheses. Standard Pascal functions include:
+
関数は関数名のあとにカッコで引数をつけて呼び出される。標準の Pascal 関数には以下のものが含まれる。
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 35: Line 36:
 
|}
 
|}
  
For ordinal data types (integer or char), where the allowable values have a distinct predecessor and successor, you can use these functions:
+
順序型データタイプ(integer or char)は、その前後に明らかな値を持ち、次のような関数が利用できる。
 
{| class="wikitable"
 
{| class="wikitable"
 
!Function !!Description !!Argument type !!Return type
 
!Function !!Description !!Argument type !!Return type
Line 48: Line 49:
 
|}
 
|}
  
Real is not an ordinal data type! That's because it has no distinct successor or predecessor. What is the successor of 56.0? Is it 56.1, 56.01, 56.001, 56.0001?
+
実数は順序型データタイプではない。なぜなら前後に明らかな値をもっていないからである。56.0の次の値は何だろうか? 56.1だろうか、あるいは56.01、56.001、それとも56.0001だろうか?
  
However, for an integer 56, there is a distinct predecessor — 55 — and a distinct successor — 57.
+
しかし、整数の56に対しては明らかな前の値55と明らかな次の値57が存在している。
  
The same is true of characters:
+
同じことが文字にも言える。
 
<syntaxhighlight>
 
<syntaxhighlight>
 
'b'
 
'b'
Successor: 'c'
+
次の文字: 'c'
Predecessor: 'a'
+
前の文字: 'a'
 
</syntaxhighlight>
 
</syntaxhighlight>
The above is not an exhaustive list, as modern Pascal compilers include thousands of functions for all sorts of purposes. Check your compiler documentation for more.
+
上に挙げたのは完全なリストではない。現在の Pascal コンパイラはあらゆる種類の目的のために数千もの関数を含んでいるのである。さらに知りたければ自分のコンパイラの資料をチェックすると良い。
  
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"

Revision as of 12:50, 22 July 2015

български (bg) Deutsch (de) English (en) français (fr) 日本語 (ja) 한국어 (ko) русский (ru) 中文(中国大陆)‎ (zh_CN)

1F - 標準関数 (著者: Tao Yue, 状態: 原文のまま)

Pascal には利用可能な標準的数学関数がいくつか用意されている。 たとえば、πのsinの値を求めるのは以下のようになる。

value := sin (3.1415926535897932);

sin関数は3角法のすべての関数がそうであるように、ラジアンで表現される角度に適用できることに注意しよう。問題がなければ、値は0になるはずである。

関数は関数名のあとにカッコで引数をつけて呼び出される。標準の Pascal 関数には以下のものが含まれる。

Function Description Argument type Return type
abs absolute value real or integer same as argument
arctan arctan in radians real or integer real
cos cosine of a radian measure real or integer real
exp e to the given power real or integer real
ln natural logarithm real or integer real
round round to nearest integer real integer
sin sin of a radian measure real or integer real
sqr square (power 2) real or integer same as argument
sqrt square root (power 1/2) real or integer real
trunc truncate (round down) real or integer integer

順序型データタイプ(integer or char)は、その前後に明らかな値を持ち、次のような関数が利用できる。

Function Description Argument type Return type
chr character with given ASCII value integer char
ord ordinal value integer or char integer
pred predecessor integer or char same as argument type
succ successor integer or char same as argument type

実数は順序型データタイプではない。なぜなら前後に明らかな値をもっていないからである。56.0の次の値は何だろうか? 56.1だろうか、あるいは56.01、56.001、それとも56.0001だろうか?

しかし、整数の56に対しては明らかな前の値55と明らかな次の値57が存在している。

同じことが文字にも言える。

'b'
次の文字: 'c'
前の文字: 'a'

上に挙げたのは完全なリストではない。現在の Pascal コンパイラはあらゆる種類の目的のために数千もの関数を含んでいるのである。さらに知りたければ自分のコンパイラの資料をチェックすると良い。

previous contents next