Skip site navigation (1) Skip section navigation (2)

Re: BUG #2357: docs for mod() are wrong

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Philip Crotwell" <crotwell(at)seis(dot)sc(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2357: docs for mod() are wrong
Date: 2006-03-24 21:39:20
Message-ID: 10775.1143236360@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Philip Crotwell" <crotwell(at)seis(dot)sc(dot)edu> writes:
> It would be nice if mod could directly take a double,

Given the inherent approximate nature of float arithmetic, I'm not sure
this makes a lot of sense.  How often do you really do modulo on floats?

> but if not the docs
> should say that the arguments should be NUMERIC

That would be incorrect.  We have it for all the exact numeric types.

regression=# \df mod
                     List of functions
   Schema   | Name | Result data type | Argument data types
------------+------+------------------+---------------------
 pg_catalog | mod  | bigint           | bigint, bigint
 pg_catalog | mod  | integer          | integer, integer
 pg_catalog | mod  | integer          | integer, smallint
 pg_catalog | mod  | integer          | smallint, integer
 pg_catalog | mod  | numeric          | numeric, numeric
 pg_catalog | mod  | smallint         | smallint, smallint
(6 rows)

I don't see an easy way to cram that statement into the small amount of
space available in the table though :-(

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-03-24 21:40:58
Subject: Re: BUG #2355: Problem with INHERITS
Previous:From: Tom LaneDate: 2006-03-24 21:35:52
Subject: Re: BUG #2356: sqrt and cbrt return different types

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group