Numerical Operators

I l @ ve RuBoard

Numerical operators return a new value from the supplied elements.

Listing

 !                     Factorial  !!                    Factorial (left operator)  %                     Mod or truncate  *                     Multiplication  +                     Addition  -                     Subtraction  /                     Division  :                     Exponentiation  @                     Absolute value  ^                     Exponentiation                       Square root  /                   Cube root  &                     Binary AND                       Binary OR  #                     Binary XOR  ~                     Binary NOT  <<                    Binary shift left  >>                    Binary shift right 
Notes/Examples

Here are some examples of numerical operators in action:

Operator

Supplied Values

Result

Addition

5+5

10

Square root

/81

9

Absolute value

@-8

8

Cube root

/343

7

Factorial

3!

6

Left factorial

!3

6

Binary AND

1&5

1

Binary XOR

1#5

4

Binary left shift

1<<4

16

The binary operators also function on BIT and BITVARYING d ata types. For instance:

Operator

Supplied Values

Result

Binary AND

B'10001'&B'01101'

B'00001'

Binary NOT

~B'01110'

B'10001'

I l @ ve RuBoard


PostgreSQL Essential Reference
PostgreSQL Essential Reference
ISBN: 0735711216
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Barry Stinson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net