Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGBt8-0008Vg-Q8 for pgsql-general@arkaria.postgresql.org; Wed, 18 Aug 2021 03:05:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mGBt7-0006Wb-OZ for pgsql-general@arkaria.postgresql.org; Wed, 18 Aug 2021 03:05:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGBt7-0006WS-6f for pgsql-general@lists.postgresql.org; Wed, 18 Aug 2021 03:05:09 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mGBt4-0002iw-Mf for pgsql-general@lists.postgresql.org; Wed, 18 Aug 2021 03:05:08 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id bl13so957122qvb.5 for ; Tue, 17 Aug 2021 20:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=N4KuQOKrN8efANoNj4pFk0lSja8Hocpzuqd1sJ/tupY=; b=p5Wo9cDXz5VIRkKboJAuiPWNhNzIH+4mbIb+Nv4sOo9uAYEaD/JsBejgDsDYfmpxJ8 G2PUFSEdbqt6RNv40bRGUJC1AW4gwn9/bFI20rXrEZcZG7tO9Xrxke4RYqtMoERP56yd ZZcmnuKs6Wdbbno047FG9CSHiRPP2aIVRFXZWIhHHMUBPPIoAGqwR0EqZ32fJq6ZgCRT AmLZRGwN7mYLACVoo4kyed8VXt65N8nCp1k780fDX775OqltpxRLQOQJs88E68IzskQO 4Rxn25PIH6Psky5etikBvQhmOd3Yn7twhytcHlKsL12YKAhDmooK0FiEqIXnf+pHdZkS XRZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=N4KuQOKrN8efANoNj4pFk0lSja8Hocpzuqd1sJ/tupY=; b=CH8gTy7ksMgcezTSvc811pQo812ZnPwiH4SgHLyOguoSO2/VgHdkOatFX9DjlMyRQZ W0Qyl/qiJXLdr62rRwEzK5xriiIHr9Z0i1m973NwbnpPF18+HmuBv2XegDc9hGtALzPO RPID0hrLC/EwljL6ml3KXmID8UoBDmKyUcmcTzjHnA0brA0x+xSIWs+6n10vDyU9qbH/ RKVMIcasFAS+K6noRanfSAO40u9Sg9Ry27IUBcooISugnmDSQSDqAeVhUEtnfOEyPfhP J9tg1HHY5N8d65ePfh/yt7sSo984iV/k6D2WU7HYNZ+2q4quze0afbi0Wx0+bVYFLFWU 7deQ== X-Gm-Message-State: AOAM533Aa44ZXZCnFJaP0pva5BFaKMHaqkfo8zeI0E6EdcdrCa/aiU4W SC2N5u7QiiP508canlheVL5mQ1uL2owj4g== X-Google-Smtp-Source: ABdhPJzQEFG8rf6yLpV+dDoymyIVou3we3cmF+YJVxdqOI4eDceuTTLZMm6VTWB+V+vIiKFueDJJ2A== X-Received: by 2002:a05:6214:23cc:: with SMTP id hr12mr6821372qvb.56.1629255904890; Tue, 17 Aug 2021 20:05:04 -0700 (PDT) Received: from [192.168.2.100] (pool-100-8-54-81.nwrknj.fios.verizon.net. [100.8.54.81]) by smtp.gmail.com with ESMTPSA id g12sm2046882qtq.92.2021.08.17.20.05.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Aug 2021 20:05:04 -0700 (PDT) Subject: Re: Serious Assistance with PostgreSQL True Infinite Arbitrary Precision Maths. To: pgsql-general@lists.postgresql.org References: From: Mladen Gogala Message-ID: <01cc156c-04be-a6fa-2b6e-88c267c72ba0@gmail.com> Date: Tue, 17 Aug 2021 23:05:04 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------27E5A4B8662C32BD9D5DF6E2" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------27E5A4B8662C32BD9D5DF6E2 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit 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 --------------27E5A4B8662C32BD9D5DF6E2 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

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
--------------27E5A4B8662C32BD9D5DF6E2--