Re: Working with fixed-point calculations in C - Mailing list pgsql-general

From Tom Lane
Subject Re: Working with fixed-point calculations in C
Date
Msg-id 3607050.1638934898@sss.pgh.pa.us
Whole thread Raw
In response to Working with fixed-point calculations in C  (Oskar Stenberg <oskar_stenberg@outlook.com>)
Responses Re: Working with fixed-point calculations in C  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
RE: Working with fixed-point calculations in C  (Oskar Stenberg <oskar_stenberg@outlook.com>)
List pgsql-general
Oskar Stenberg <oskar_stenberg@outlook.com> writes:
> I need to make some fixed-point calculations inside the C code that I'm
> developing as an extension to PostgreSQL. I was reading a bit, and if I
> understood the datatype NUMBER correctly, it seems to be just what I'm
> looking for, a fixed-point datatype. (I couldn't actually find any
> thing in the documentation that specifically mentions that it is a
> fixed point datatype. But it seems to work the same. So I might be
> wrong here and if so please tell me)

I think what you are looking for is NUMERIC.  (The type name NUMBER
is an Oracle-ism, I believe.  I'm not sure how closely that corresponds
to our NUMERIC.)

> Link to the documentation:
> https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-C-TYPE-TABLE

Hmm, that table seems a bit incomplete/out of date.  While it's
not really meant to cover every type, surely it should mention
bigint, numeric, and timestamptz ...

            regards, tom lane



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: CTE Materialization
Next
From: Vikas Sharma
Date:
Subject: Re: how to get value of parameter set in session for other user