Skip to content
This repository
Browse code

The docs use PostgreSQL specific lexers

  • Loading branch information...
commit 1deedd01d72aefc98d3ed23ace8d605224d26fdf 1 parent a15601f
Daniele Varrazzo authored

Showing 3 changed files with 20 additions and 20 deletions. Show diff stats Hide diff stats

  1. +2 2 docs/install.rst
  2. +11 11 docs/mpq.rst
  3. +7 7 docs/mpz.rst
4 docs/install.rst
Source Rendered
@@ -52,7 +52,7 @@ also provided in the same directory to remove the installed objects.
52 52 With PostgreSQL 9.1 the library is packaged as an extension: once built and
53 53 installed in the cluster, use the command:
54 54
55   -.. code-block:: sql
  55 +.. code-block:: psql
56 56
57 57 =# CREATE EXTENSION pgmp;
58 58
@@ -60,7 +60,7 @@ to install it in a database. If your database was migrated from a previous
60 60 PostgreSQL version, you can convert the `!pgmp` objects into a packaged
61 61 extension using the command:
62 62
63   -.. code-block:: sql
  63 +.. code-block:: psql
64 64
65 65 =# CREATE EXTENSION pgmp FROM unpackaged;
66 66
22 docs/mpq.rst
Source Rendered
@@ -14,11 +14,11 @@ Floating point types (`!float4`, `!float8`) are converted without loss as
14 14 well... but with some surprise, as many fractions with finite decimal
15 15 expansion have no finite expansion in binary.
16 16
17   -.. code-block:: sql
  17 +.. code-block:: psql
18 18
19   - =# select 10.1::numeric::mpq as numeric,
20   - -# 10.1::float4::mpq as single,
21   - -# 10.1::float8::mpq as double;
  19 + =# select 10.1::numeric::mpq as "numeric",
  20 + -# 10.1::float4::mpq as "single",
  21 + -# 10.1::float8::mpq as "double";
22 22 numeric | single | double
23 23 ---------+----------------+----------------------------------
24 24 101/10 | 5295309/524288 | 5685794529555251/562949953421312
@@ -30,11 +30,11 @@ will round the values to the precision allowed by the types (in case of
30 30 overflow the value will be *Infinity*). Conversion to `!numeric` will perform
31 31 a rounding to the precision set for the target type.
32 32
33   -.. code-block:: sql
  33 +.. code-block:: psql
34 34
35   - =# select mpq('4/3')::integer as integer,
36   - -# mpq('4/3')::float4 as single,
37   - -# mpq('4/3')::decimal(10,3) as decimal;
  35 + =# select mpq('4/3')::integer as "integer",
  36 + -# mpq('4/3')::float4 as "single",
  37 + -# mpq('4/3')::decimal(10,3) as "decimal";
38 38 integer | single | decimal
39 39 ---------+---------+---------
40 40 1 | 1.33333 | 1.333
@@ -143,20 +143,20 @@ canonical form.
143 143 The function is useful for finding rational approximations to a given
144 144 floating-point number:
145 145
146   - .. code-block:: sql
  146 + .. code-block:: psql
147 147
148 148 =# select limit_den(pi(), 10);
149 149 22/7
150 150
151 151 or for recovering a rational number that's represented as a float:
152 152
153   - .. code-block:: sql
  153 + .. code-block:: psql
154 154
155 155 =# select mpq(cos(pi()/3));
156 156 4503599627370497/9007199254740992
157 157 =# select limit_den(cos(pi()/3));
158 158 1/2
159   - =# select limit_den(10.1::float);
  159 + =# select limit_den(10.1::float4);
160 160 101/10
161 161
162 162 This function is not part of the GMP library: it is ported instead `from
14 docs/mpz.rst
Source Rendered
@@ -9,7 +9,7 @@ to `!mpz`. Not integer types (`!float4`, `!float8`, `!numeric`) are truncated.
9 9 Cast from integer types are automatic, whereas non integer require explicit
10 10 cast (but are implicitly converted in assignment).
11 11
12   -.. code-block:: sql
  12 +.. code-block:: postgres
13 13
14 14 SELECT mpz(10000); -- Cast using mpz as a function
15 15 SELECT 10000::mpz; -- PostgreSQL-style cast
@@ -43,10 +43,10 @@ operators. Indexes on `!mpz` columns can be created using the *btree* or the
43 43 have the same value. For bases 37 to 62, upper-case letter represent the
44 44 usual 10..35 while lower-case letter represent 36..61.
45 45
46   - .. code-block:: sql
  46 + .. code-block:: psql
47 47
48   - =# SELECT '0x10'::mpz AS hex, '10'::mpz AS dec,
49   - -# '010'::mpz AS oct, '0b10'::mpz AS bin;
  48 + =# SELECT '0x10'::mpz AS "hex", '10'::mpz AS "dec",
  49 + -# '010'::mpz AS "oct", '0b10'::mpz AS "bin";
50 50 hex | dec | oct | bin
51 51 -----+-----+-----+-----
52 52 16 | 10 | 8 | 2
@@ -301,7 +301,7 @@ Root Extraction Functions
301 301 Return a tuple of 2 elements with the truncated integer part of the *n*\th
302 302 root of *op* and the remainder (*i.e.* *op* - *root* ^ *n*).
303 303
304   - .. code-block:: sql
  304 + .. code-block:: psql
305 305
306 306 =# select * from rootrem(28, 3);
307 307 root | rem
@@ -317,7 +317,7 @@ Root Extraction Functions
317 317 Return a tuple of 2 elements with the truncated integer part of the square
318 318 root of *op* and the remainder (*i.e.* *op* - *root* \* *root*).
319 319
320   - .. code-block:: sql
  320 + .. code-block:: psql
321 321
322 322 =# select * from sqrtrem(83);
323 323 root | rem
@@ -393,7 +393,7 @@ Number Theoretic Functions
393 393 The \hspace{} are there to avoid the vim rest syntax highlighter to
394 394 get crazy.
395 395
396   - .. code-block:: sql
  396 + .. code-block:: psql
397 397
398 398 =# select * from gcdext(6, 15);
399 399 g | s | t

0 comments on commit 1deedd0

Please sign in to comment.
Something went wrong with that request. Please try again.