free pascal里的 ** 运算是干什么的?
来源:百度知道 编辑:UC知道 时间:2024/05/12 01:24:50
free pascal里的 ** 运算是干什么的?好像是次幂,但4**4为什么不好使?
free pascal的Language reference guide(运算符说明部分)
12.2 Operator declarations
To define the action of an operator is much like defining a function:
Operator definitions
-- operator definition operator assignment operator definition
......
-- arithmetic operator definition +( parameter list ) -
-
*
/
**
-- comparision operator definition = ( parameter list ) -
<
<=
>
>=
(运算符重载说明部分):
Arithmetic operators define the action of a binary operator. Possible operations are:
multiplication to multiply two types, the * multiplication operator must be overloaded.
......
exponentiation to exponentiate two types, the ** exponentiation operator must be overloaded -->("exponentiation"为幂运算)
free pascal的Language reference guide(运算符说明部分)
12.2 Operator declarations
To define the action of an operator is much like defining a function:
Operator definitions
-- operator definition operator assignment operator definition
......
-- arithmetic operator definition +( parameter list ) -
-
*
/
**
-- comparision operator definition = ( parameter list ) -
<
<=
>
>=
(运算符重载说明部分):
Arithmetic operators define the action of a binary operator. Possible operations are:
multiplication to multiply two types, the * multiplication operator must be overloaded.
......
exponentiation to exponentiate two types, the ** exponentiation operator must be overloaded -->("exponentiation"为幂运算)
是幂运算。
但在标准pascal中,先引用math单元,再用power函数。
但是**运算符保留。
即
2**4=16
等同于
uses math;
a:=power(2,4)
结果是a=16
有这种运算。。。
4**4能算啊
是幂运算。
即
3**4=64
等同于
uses math;
a:=power(3,4)
结果是a=64
幂次运算
2**10=1024
等于
uses math;
a:=power(2,10)
确实是幂运算
**运算符保留
是乘方
a**b=a的b次方