Search Postgresql Archives

Working with fixed-point calculations in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

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)

Anyway, I thought that it would be good to store the decimal numbers in the database as the datatype NUMBER, and then just use the C version of it when I need to work with it in the code. But when I look at the documentation for writing C functions, I can't find the C version of it? Is that something that just hasn't made it to the documentation, or is there a reason for it not being listed there?

Was hoping that I wouldn't need to reinvent the wheel here or include another library to handle this, as it increases the risk of creating bugs. But if I have to I'll do it.

Link to the documentation: https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-C-BASETYPE
You have to scroll down a little and you will find a table matching PostgreSQL:s datatypes with the datatypes in C

Best regards
Oskar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux