PostgreSQL�ο�¿���η����Ф��뻻�ѱ黻�Ҥ��Ѱդ���Ƥ��ޤ������Ƥβ�ǽ�ʱ黻���Ф��ư���Ū�ʻ��ѵ���Τʤ������㤨�С�����/����ǡ������ˤˤĤ��Ƥϡ���³������Ǽºݤ�ư����������ޤ���
ɽ9-2 shows the available mathematical operators.
ɽ 9-2. ���ѱ黻��
�黻��̾ | ���� | �� | ��� |
---|---|---|---|
+ | �� | 2 + 3 | 5 |
- | �� | 2 - 3 | -1 |
* | �� | 2 * 3 | 6 |
/ | ���������γ�껻�Ǥ�;����ڤ�Τơ� | 4 / 2 | 2 |
% | ��;��;��� | 5 % 4 | 1 |
^ | �߾� | 2.0 ^ 3.0 | 8 |
|/ | ʿ���� | |/ 25.0 | 5 |
||/ | ���� | ||/ 27.0 | 3 |
! | ���� | 5 ! | 120 |
!! | ��������ֱ黻�ҡ� | !! 5 | 120 |
@ | ������ | @ -5.0 | 5 |
& | �Х��ʥ��AND | 91 & 15 | 11 |
| | �Х��ʥ��OR | 32 | 3 | 35 |
# | �Х��ʥ��XOR | 17 # 5 | 20 |
~ | �Х��ʥ��NOT< | ~1 | -2 |
<< | �Х��ʥ�κ����ե� | 1 << 4 | 16 |
>> | �Х��ʥ�α����ե� | 8 >> 2 | 2 |
�ӥåȱ黻�Ҥ������ǡ������Τߤ˻��ѤǤ��ޤ�������¾�α黻�Ҥ����Ƥο��ͥǡ������˻��ѤǤ��ޤ����ޤ����ӥåȱ黻�Ҥ�ɽ9-10�˼�����bit��bit varying�ӥå�ʸ�����Ф��Ƥ���Ѥ��뤳�Ȥ��Ǥ��ޤ���
ɽ9-3�˻��Ѳ�ǽ�ʻ��Ѵؿ����ޤ��� ����ɽ���dp�ϡ�double precision���̣���ޤ��������ؿ���¿���ϡ��ۤʤ�����������ʣ���η�������Ƥ��ޤ������̤ʾ������������Ǥ�շ����δؿ��Ϥ��ΰ�����Ʊ���ǡ��������֤��ޤ���double precision�ǡ������Ф���ؿ��ΤۤȤ�ɤϥۥ��ȥ����ƥ��C�饤�֥��ξ��ؤ˼�������Ƥ��ޤ������Τ��ᡢ������ξ������٤ȿ��ϥۥ��ȥ����ƥ�˰�¸�����Ѥ��ޤ���
ɽ 9-3. ���Ѵؿ�
�ؿ� | ����ͷ� | ���� | �� | ��� |
---|---|---|---|---|
abs (x) | ��x��Ʊ���� | ������ | abs(-17.4) | 17.4 |
cbrt (dp) | dp | ���� | cbrt(27.0) | 3 |
ceil (dp or numeric) | �����Ϸ���Ʊ��� | ������꾮�����ʤ��Ǿ������� | ceil(-42.8) | -42 |
ceiling (dp or numeric) | �����Ϸ���Ʊ��� | ������꾮�����ʤ��Ǿ���������ceil ����̾�� | ceiling(-95.3) | -95 |
degrees (dp) | dp | �饸������б������� | degrees(0.5) | 28.6478897565412 |
exp (dp or numeric) | �����Ϸ���Ʊ��� | �ؿ� | exp(1.0) | 2.71828182845905 |
floor (dp or numeric) | �����Ϸ���Ʊ��� | ��������礭���ʤ���������� | floor(-42.8) | -43 |
ln (dp or numeric) | �����Ϸ���Ʊ��� | �����п� | ln(2.0) | 0.693147180559945 |
log (dp or numeric) | �����Ϸ���Ʊ��� | 10����Ȥ����п��ʾ����п��� | log(100.0) | 2 |
log (b numeric,
x numeric) | numeric | b ����Ȥ����п� | log(2.0, 64.0) | 6.0000000000 |
mod (y ,
x ) | �ʰ����η���Ʊ��� | y /x �ξ�; | mod(9,4) | 1 |
pi () | dp | "��Ψ�ʦС�"��� | pi() | 3.14159265358979 |
power (a dp,
b dp) | dp | a ��b �� | power(9.0, 3.0) | 729 |
power (a numeric,
b numeric) | numeric | a ��b �� | power(9.0, 3.0) | 729 |
radians (dp) | dp | �٤��б�����饸���� | radians(45.0) | 0.785398163397448 |
random () | dp | 0.0��1.0������� | random() | |
round (dp or numeric) | �����Ϸ���Ʊ��� | �ͼθ��� | round(42.4) | 42 |
round (v numeric, s int) | numeric | s �η�ǻͼθ��� | round(42.4382, 2) | 42.44 |
setseed (dp) | int | ���random()�ƤӽФ��ǻ��Ѥ��������� | setseed(0.54823) | 1177314959 |
sign (dp or numeric) | �����Ϸ���Ʊ��� | ����������-1��0��+1�� | sign(-8.4) | -1 |
sqrt (dp or numeric) | �����Ϸ���Ʊ��� | ʿ���� | sqrt(2.0) | 1.4142135623731 |
trunc (dp or numeric) | �����Ϸ���Ʊ��� | �ڤ�Τ� | trunc(42.8) | 42 |
trunc (v numeric, s int) | numeric | s �η���ڤ�Τ� | trunc(42.4382, 2) | 42.43 |
width_bucket (op numeric, b1 numeric, b2 numeric, count int) | int | operand ��������Ƥ��롢���b1 ������b2 ���Х��åȿ�count �������٥ҥ��ȥ����ΥХ��åȤ��֤��ޤ���
| width_bucket(5.35, 0.024, 10.06, 5) | 3 |
�Ǹ�ˡ����Ѳ�ǽ�ʻ��Ѵؿ���ɽ9-4�˼����ޤ������Ƥλ��Ѵؿ���double precision�ǡ������ΰ���������ͤ���ޤ���