shows the available
mathematical functions. In the table, dp
- indicates double precision. The functions
- exp, ln,
- log, pow,
- round (1 argument), sqrt,
- and trunc (1 argument) are also available for
- the type numeric in place of double
- precision. Functions returning a numeric
- result take numeric input arguments, unless otherwise
- specified. Many of these functions are implemented on top of the
- host system's C library; accuracy and behavior in boundary cases
- could therefore vary depending on the host system.
+ indicates double precision. Many of these functions
+ are provided in multiple forms with different argument types.
+ Except where noted, any given form of a function returns the same
+ datatype as its argument.
+ The functions working with double precision data are mostly
+ implemented on top of the host system's C library; accuracy and behavior in
+ boundary cases may therefore vary depending on the host system.
|
- ceil(numeric)
- numeric
+ ceil(dp or numeric)
+ (same as input)
smallest integer not less than argument
ceil(-42.8)
-42
|
- exp(dp)
- dp
+ exp(dp or numeric)
+ (same as input)
exponential
exp(1.0)
2.71828182845905
|
- floor(numeric)
- numeric
+ floor(dp or numeric)
+ (same as input)
largest integer not greater than argument
floor(-42.8)
-43
|
- ln(dp)
- dp
+ ln(dp or numeric)
+ (same as input)
natural logarithm
ln(2.0)
0.693147180559945
|
- log(dp)
- dp
+ log(dp or numeric)
+ (same as input)
base 10 logarithm
log(100.0)
2
|
dp
raise a number to exponent e
pow(9.0, 3.0)
729
+ |
+ numeric
+
raise a number to exponent e
+ pow(9.0, 3.0)
+ 729
+
+
|
radians(dp)
dp
|
random()
dp
- value between 0.0 to 1.0
+ random value between 0.0 and 1.0
random()
|
- round(dp)
- dp
+ round(dp or numeric)
+ (same as input)
round to nearest integer
round(42.4)
42
-->
|
- sign(numeric)
- numeric
+ sign(dp or numeric)
+ (same as input)
sign of the argument (-1, 0, +1)
sign(-8.4)
-1
|
- sqrt(dp)
- dp
+ sqrt(dp or numeric)
+ (same as input)
square root
sqrt(2.0)
1.4142135623731
|
- trunc(dp)
- dp
+ trunc(dp or numeric)
+ (same as input)
truncate toward zero
trunc(42.8)
42
|
- trunc(numeric,
+
trunc(v numeric, s integer)
numeric
truncate to s decimal places
trunc(42.4382, 2)
Finally, shows the
available trigonometric functions. All trigonometric functions
- have arguments and return values of type double
+ take arguments and return values of type double
precision.
This section describes functions and operators for examining and
- manipulating binary string values. Strings in this context include
+ manipulating binary string values. Strings in this context mean
values of the type BYTEA.
|
-
set_byte(string, offset)
bytea
Set byte in string.
|
-
set_bit(string, offset)
bytea
Set bit in string.