Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The docs use PostgreSQL specific lexers

  • Loading branch information...
commit 1deedd01d72aefc98d3ed23ace8d605224d26fdf 1 parent a15601f
Daniele Varrazzo authored
Showing with 20 additions and 20 deletions.
  1. +2 −2 docs/install.rst
  2. +11 −11 docs/mpq.rst
  3. +7 −7 docs/mpz.rst
4 docs/install.rst
View
@@ -52,7 +52,7 @@ also provided in the same directory to remove the installed objects.
With PostgreSQL 9.1 the library is packaged as an extension: once built and
installed in the cluster, use the command:
-.. code-block:: sql
+.. code-block:: psql
=# CREATE EXTENSION pgmp;
@@ -60,7 +60,7 @@ to install it in a database. If your database was migrated from a previous
PostgreSQL version, you can convert the `!pgmp` objects into a packaged
extension using the command:
-.. code-block:: sql
+.. code-block:: psql
=# CREATE EXTENSION pgmp FROM unpackaged;
22 docs/mpq.rst
View
@@ -14,11 +14,11 @@ Floating point types (`!float4`, `!float8`) are converted without loss as
well... but with some surprise, as many fractions with finite decimal
expansion have no finite expansion in binary.
-.. code-block:: sql
+.. code-block:: psql
- =# select 10.1::numeric::mpq as numeric,
- -# 10.1::float4::mpq as single,
- -# 10.1::float8::mpq as double;
+ =# select 10.1::numeric::mpq as "numeric",
+ -# 10.1::float4::mpq as "single",
+ -# 10.1::float8::mpq as "double";
numeric | single | double
---------+----------------+----------------------------------
101/10 | 5295309/524288 | 5685794529555251/562949953421312
@@ -30,11 +30,11 @@ will round the values to the precision allowed by the types (in case of
overflow the value will be *Infinity*). Conversion to `!numeric` will perform
a rounding to the precision set for the target type.
-.. code-block:: sql
+.. code-block:: psql
- =# select mpq('4/3')::integer as integer,
- -# mpq('4/3')::float4 as single,
- -# mpq('4/3')::decimal(10,3) as decimal;
+ =# select mpq('4/3')::integer as "integer",
+ -# mpq('4/3')::float4 as "single",
+ -# mpq('4/3')::decimal(10,3) as "decimal";
integer | single | decimal
---------+---------+---------
1 | 1.33333 | 1.333
@@ -143,20 +143,20 @@ canonical form.
The function is useful for finding rational approximations to a given
floating-point number:
- .. code-block:: sql
+ .. code-block:: psql
=# select limit_den(pi(), 10);
22/7
or for recovering a rational number that's represented as a float:
- .. code-block:: sql
+ .. code-block:: psql
=# select mpq(cos(pi()/3));
4503599627370497/9007199254740992
=# select limit_den(cos(pi()/3));
1/2
- =# select limit_den(10.1::float);
+ =# select limit_den(10.1::float4);
101/10
This function is not part of the GMP library: it is ported instead `from
14 docs/mpz.rst
View
@@ -9,7 +9,7 @@ to `!mpz`. Not integer types (`!float4`, `!float8`, `!numeric`) are truncated.
Cast from integer types are automatic, whereas non integer require explicit
cast (but are implicitly converted in assignment).
-.. code-block:: sql
+.. code-block:: postgres
SELECT mpz(10000); -- Cast using mpz as a function
SELECT 10000::mpz; -- PostgreSQL-style cast
@@ -43,10 +43,10 @@ operators. Indexes on `!mpz` columns can be created using the *btree* or the
have the same value. For bases 37 to 62, upper-case letter represent the
usual 10..35 while lower-case letter represent 36..61.
- .. code-block:: sql
+ .. code-block:: psql
- =# SELECT '0x10'::mpz AS hex, '10'::mpz AS dec,
- -# '010'::mpz AS oct, '0b10'::mpz AS bin;
+ =# SELECT '0x10'::mpz AS "hex", '10'::mpz AS "dec",
+ -# '010'::mpz AS "oct", '0b10'::mpz AS "bin";
hex | dec | oct | bin
-----+-----+-----+-----
16 | 10 | 8 | 2
@@ -301,7 +301,7 @@ Root Extraction Functions
Return a tuple of 2 elements with the truncated integer part of the *n*\th
root of *op* and the remainder (*i.e.* *op* - *root* ^ *n*).
- .. code-block:: sql
+ .. code-block:: psql
=# select * from rootrem(28, 3);
root | rem
@@ -317,7 +317,7 @@ Root Extraction Functions
Return a tuple of 2 elements with the truncated integer part of the square
root of *op* and the remainder (*i.e.* *op* - *root* \* *root*).
- .. code-block:: sql
+ .. code-block:: psql
=# select * from sqrtrem(83);
root | rem
@@ -393,7 +393,7 @@ Number Theoretic Functions
The \hspace{} are there to avoid the vim rest syntax highlighter to
get crazy.
- .. code-block:: sql
+ .. code-block:: psql
=# select * from gcdext(6, 15);
g | s | t
Please sign in to comment.
Something went wrong with that request. Please try again.