Clarify documentation of ceil/ceiling/floor functions.
authorTom Lane
Thu, 9 Jun 2016 15:58:00 +0000 (11:58 -0400)
committerTom Lane
Thu, 9 Jun 2016 15:58:00 +0000 (11:58 -0400)
Document these as "nearest integer >= argument" and "nearest integer <=
argument", which will hopefully be less confusing than the old formulation.
New wording is from Matlab via Dean Rasheed.

I changed the pg_description entries as well as the SGML docs.  In the
back branches, this will only affect installations initdb'd in the future,
but it should be harmless otherwise.

Discussion: 

doc/src/sgml/func.sgml
src/include/catalog/pg_proc.h

index 82e04125746eee60bae6d91cc5a5ea3f2fa8321b..a15cf2d179159d82f62cb35c3af5b4b1087ea823 100644 (file)
         ceil(dp or numeric)
        
        (same as input)
-       smallest integer not less than argument
+       nearest integer greater than or equal to argument
        ceil(-42.8)
        -42
       
         ceiling(dp or numeric)
        
        (same as input)
-       smallest integer not less than argument (alias for ceil)
+       nearest integer greater than or equal to argument (same as ceil)
        ceiling(-95.3)
        -95
       
         floor(dp or numeric)
        
        (same as input)
-       largest integer not greater than argument
+       nearest integer less than or equal to argument
        floor(-42.8)
        -43
       
index 5c58108bda99d1d032e971b81bf16890f9ecb5dd..dadf7604251792d8e52c6cbde74b045ee6a3a0d5 100644 (file)
@@ -411,11 +411,11 @@ DESCR("round to nearest integer");
 DATA(insert OID = 229 (  dtrunc               PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dtrunc _null_ _null_ _null_ ));
 DESCR("truncate to integer");
 DATA(insert OID = 2308 ( ceil             PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dceil _null_ _null_ _null_ ));
-DESCR("smallest integer >= value");
+DESCR("nearest integer >= value");
 DATA(insert OID = 2320 ( ceiling          PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dceil _null_ _null_ _null_ ));
-DESCR("smallest integer >= value");
+DESCR("nearest integer >= value");
 DATA(insert OID = 2309 ( floor            PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dfloor _null_ _null_ _null_ ));
-DESCR("largest integer <= value");
+DESCR("nearest integer <= value");
 DATA(insert OID = 2310 ( sign             PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dsign _null_ _null_ _null_ ));
 DESCR("sign of value");
 DATA(insert OID = 230 (  dsqrt            PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 701 "701" _null_ _null_ _null_ _null_ _null_    dsqrt _null_ _null_ _null_ ));
@@ -2318,11 +2318,11 @@ DESCR("value truncated to 'scale'");
 DATA(insert OID = 1710 ( trunc                 PGNSP PGUID 14 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ "select pg_catalog.trunc($1,0)" _null_ _null_ _null_ ));
 DESCR("value truncated to 'scale' of zero");
 DATA(insert OID = 1711 ( ceil                  PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ ));
-DESCR("smallest integer >= value");
+DESCR("nearest integer >= value");
 DATA(insert OID = 2167 ( ceiling               PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_ceil _null_ _null_ _null_ ));
-DESCR("smallest integer >= value");
+DESCR("nearest integer >= value");
 DATA(insert OID = 1712 ( floor                 PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 1700 "1700" _null_ _null_ _null_ _null_ _null_ numeric_floor _null_ _null_ _null_ ));
-DESCR("largest integer <= value");
+DESCR("nearest integer <= value");
 DATA(insert OID = 1718 ( numeric_eq                PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_eq _null_ _null_ _null_ ));
 DATA(insert OID = 1719 ( numeric_ne                PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_ne _null_ _null_ _null_ ));
 DATA(insert OID = 1720 ( numeric_gt                PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "1700 1700" _null_ _null_ _null_ _null_ _null_ numeric_gt _null_ _null_ _null_ ));