'What I am trying to find is PostgreSQL support for High Precision numbers, running inside the database engine itself. PostgreSQL, presently at default, has only got limited function support, on the range of a double.'
My needs for High Precision Arithmetic require new types and logic inside PostgreSQL. What I am after is an extension that comes with an automatic installer file, standalone, that supports all classic operators and classic mathematical functions upon and by means of two types, a High Precision Integer type and a High Precision Rational type. I am trying also to get on to someone to help from the pgmp project, who might be able to help by improving pgmp to meet these needs. I need arithmetic and comparison support on Integer and Rational (Decimal type) numbers. +, -, *,/,%, ==, !=, <>,>,<, >=, <=. Other important candidates required include +=, -=, *=, /=, %=. The trick is, that I also need full classical function support as well. What I need is: ii infinite decimal; ir infinite real; cast(ir) returns double precision; cast(double precision) returns ir; cast(ir) returns real; cast(real) return ir; cast(ir) returns numeric; cast(numeric) returns ir; cast(ir) returns decimal; cast(decimal) returns ir; cast(ii) returns bigserial; cast(bigserial) returns ii; cast(ii) returns serial; cast(serial) returns ii; cast(ii) returns smallserial; cast(smallserial) returns ii; cast(ii) returns bigint; cast(bigint) returns ii; cast(ii) returns integer; cast(integer) returns ii; cast(ii) returns smallint; cast(smallint) returns ii; cast(text as ii) returns ii; cast(text as ir) returns ir; cast(ir as text) returns text; cast(ii as text) returns text; cast(ii as ir) returns ir; cast(ir as ii) returns ii; sign(ir input) returns ir; abs(ir input) returns ir; pi(ii places) returns ir; e(ii places) returns ir; power(ir base, ir exponent) returns ir; sqrt(ir input) returns ir nroot(ii theroot, ir input) returns ir; log10(ir input) returns ir; loge(ir input) returns ir; log2(ir input) returns ir; factorial(ii input) returns ii; degrees(ir input) returns ir; radians(ir input) returns it; sind(ir input) returns ir; cosd(ir input) returns ir; tand(ir input) returns ir; asind(ir input) returns ir; acosd(ir input) returns ir; atand(ir input) returns ir; sinr(ir input) returns ir; cosr(ir input) returns ir; tanr(ir input) returns ir; asinr(ir input) returns ir; acosr(ir input) returns ir; atanr(ir input) returns ir; The last two sets of functions are forward and inverse trigonometry functions, both in degrees and radians. I also need the update module to install easily. A windows *.exe and *.msi, a Linux *.deb, *.rpm or *.bin. Is there someone or something out there that can get there? Is there anyone who can help? ________________________________ From: A Z <powerus...@live.com.au> Sent: Wednesday, 18 August 2021 1:13 PM To: Mladen Gogala <gogala.mla...@gmail.com> Subject: Re: Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths. The library that I have been using so far is ttmath, in GNU C++. That library is High Precision, in the end, and does seem to be high precision enough, accurate enough and fast enough for my programs. What I am trying to find is PostgreSQL support for High Precision numbers, running inside the database engine itself. It has only got limited function support, on the range of a double. While Full Arbitrary Precision support gets to be a storage and speed problem, for a database, which does and in real terms legitimately have a 1 Gigabyte cell limit, what I am still after is improved number support that includes integers, decimals, operators and function support to address my needs. I am also in the process of trying to communicate with someone on the pgmp project, to get them to enhance and improve what they have on offer. Is there anyone on the PostgreSQL general email list who knows any more on this issue? ________________________________ From: Mladen Gogala <gogala.mla...@gmail.com> Sent: Wednesday, 18 August 2021 1:05 PM To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org> Subject: Re: Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths. The answer for you is Pl/Python3u. It can use numpy, which supports infinite precision arithmetic and converting results to double and back. It can also do linked lists. Depending on your age and your preferences, you might try Pl/Perl. I learned Perl in 1993 and have never stopped loving it. It has several modules for the infinite precision arithmetic. My favorite is Math::BigFloat. As for the linked lists, there is List::DoubleLinked module on CPAN. In other words, all procedural extensions can be used to fulfill your requirements. BTW, one of my employers told me that Perl is verboten and that the company has standardized on Python. So I had to learn it. It's not too bad if you're in that sort of things. Regards On 8/17/21 10:49 PM, A Z wrote: Dear pgsql-general, I'm after Infinite Precision Integer (ii) or Infinite Precision Rational (ir) type and function support for PostgreSQL, as an easy installation for two new native types. That are available under free and open source conditions, for public, private and commercial, free use. I am aware of the pgmp project. While I have contacted it and and am awaiting their response, it is the case that the present state of pgmp is not enough for my needs. PostgreSQL does not have a private doubly linked list available, and so I can't assemble all this for myself, given that I do not know enough about PostgreSQL extensions and the C language. What I am after is True Arbitrary Precision Arithmetic, and not High Precision Arithmetic. What I seek would be contingent only upon available OS or Hardware memory. I need arithmetic and comparison support on Integer and Rational (Decimal type) numbers. +, -, *,/,%, ==, !=, <>,>,<, >=, <=. Other important candidates required include +=, -=, *=, /=, %=. The trick is, that I also need full classical function support as well. What I need fairly well is: cast(ir) returns double precision; cast(double precision) returns ir; cast(ir) returns real; cast(real) return ir; cast(ir) returns numeric; cast(numeric) returns ir; cast(ir) returns decimal; cast(decimal) returns ir; cast(ii) returns bigserial; cast(bigserial) returns ii; cast(ii) returns serial; cast(serial) returns ii; cast(ii) returns smallserial; cast(smallserial) returns ii; cast(ii) returns bigint; cast(bigint) returns ii; cast(ii) returns integer; cast(integer) returns ii; cast(ii) returns smallint; cast(smallint) returns ii; cast(text as ii) returns ii; cast(text as ir) returns ir; cast(ir as text) returns text; cast(ii as text) returns text; cast(ii as ir) returns ir; cast(ir as ii) returns ii; sign(ir input) returns ir; abs(ir input) returns ir; pi(ii places) returns ir; e(ii places) returns ir; power(ir base, ir exponent) returns ir; sqrt(ir input) returns ir nroot(ii theroot, ir input) returns ir; log10(ir input) returns ir; loge(ir input) returns ir; log2(ir input) returns ir; factorial(ii input) returns ii; degrees(ir input) returns ir; radians(ir input) returns it; sind(ir input) returns ir; cosd(ir input) returns ir; tand(ir input) returns ir; asind(ir input) returns ir; acosd(ir input) returns ir; atand(ir input) returns ir; sinr(ir input) returns ir; cosr(ir input) returns ir; tanr(ir input) returns ir; asinr(ir input) returns ir; acosr(ir input) returns ir; atanr(ir input) returns ir; The last two sets of functions are forward and inverse trigonometry functions, both in degrees and radians. I also need the update module to install easily. A windows *.exe and *.msi, a Linux *.deb, *.rpm or *.bin. Is there someone or something out there that can get there? -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com