BUG #2356: sqrt and cbrt return different types - Mailing list pgsql-bugs

From Philip Crotwell
Subject BUG #2356: sqrt and cbrt return different types
Date
Msg-id 200603241655.k2OGtTKE059038@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #2356: sqrt and cbrt return different types
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2356
Logged by:          Philip Crotwell
Email address:      crotwell@seis.sc.edu
PostgreSQL version: 8.1
Operating system:   linux
Description:        sqrt and cbrt return different types
Details:

The return of sqrt() is numeric but the return type of cbrt is double, which
is confusing. So, for example this works:
   select mod(sqrt(4.1), 4);
but this
   select mod(cbrt(4.1), 4);
fails with
ERROR:  function mod(double precision, integer) does not exist
and you have to do this instead:
   select mod(CAST (cbrt(4.1) AS NUMERIC), 4);

It seems to me that square root and cube root should be the same in return
type.

The docs should be updated if this change is made:
http://www.postgresql.org/docs/8.1/interactive/functions-math.html

pgsql-bugs by date:

Previous
From: "Jaime Lara Alvarez"
Date:
Subject: BUG #2355: Problem with INHERITS
Next
From: "Philip Crotwell"
Date:
Subject: BUG #2357: docs for mod() are wrong