Обсуждение: Improved PostgreSQL Mathematics Support.

Поиск
Список
Период
Сортировка

Improved PostgreSQL Mathematics Support.

От
A Z
Дата:
I have been trying to get a reply or interest in either updating
PostgreSQL to support the following, or for there to be a public,
free for any use Extension put out there, that will support the following:


############################################################
# High Precision Numeric and Elementary Functions Support. #
############################################################

-Integer (HPZ) Z, or Rational Decimal Q (HPQ) numbers support.

-Recurring Rational Numbers and recurring Irrational Numbers can be appropriately
truncated, by a precision value, to obtain an approximating value.  The latter
phenomenon is a finite Rational value, possibly with integer and/or decimal parts at the
same time.  These may be positive or negative, standard number line, values.

-Forward and Inverse operations accuracy, withstanding truncation,
can be maintained by storing and normalising the expression behind a value,
(or just include pointers to the value) and displaying the evaluation.
This system will uphold any precision.

-A defaulting number of significant figures (precision), in one copy of one field
in memory that is held in there, as a filter, for all HPZ and HPQ numbers.
For example, 20 significant figures, as a default, to start by.

-A function that varies the precision filter for every HPZ and HPQ number at once.

-Value assignment to a typed variable by =.

-Base 10 Arithmetic and comparisons support on Base 10 Integer and Rational Decimal numbers.
+,-,*,/,%,^,=,!=,<>,>,<,>=,<=, ::
These include full finite division and integer only division, with no remainder.
The defaulting ability of numbers data in lower types to automatically be casted
up to HPZ or HPQ, where specified and occuring in PostgreSQL code.

-Reified support with broader syntax and operations within PostgreSQL, in all the obvious
and less than obvious places.  Tables and related phenomena, Indexing, the Window type,
Record type, direct compatability with Aggregate and Window Functions, the Recursive keyword,
are all parts of a larger subset that may re-interact with HPZ or HPQ.

#############################################################################################

-Mathematical and Operational functions support:

precision(BIGINT input)

cast(TEXT as HPZ) returns HPZ;
cast(TEXT as HPQ) returns HPQ;
cast(HPQ as TEXT) returns TEXT;
cast(HPZ as TEXT) returns TEXT;
cast(HPZ as HPQ) returns HPQ;
cast(HPQ as HPZ) returns HPZ;
cast(HPZ as SMALLINT) returns SMALLINT;
cast(SMALLINT as HPQ) returns HPZ;
cast(HPZ as INTEGER) returns INTEGER;
cast(INTEGER as HPZ) returns HPZ;
cast(HPZ as BIGINT) returns BIGINT;
cast(BIGINT as HPZ) returns HPZ;
cast(HPQ as REAL) returns REAL;
cast(REAL as HPQ) returns HPQ
cast(DOUBLE PRECISION as HPQ) returns HPQ;
cast(HPQ as DOUBLE PRECISION) returns DOUBLE PRECISION;
cast(HPQ as DECIMAL) returns DECIMAL;
cast(DECIMAL as HPQ) returns HPQ;

sign(HPQ input) returns HPQ;
abs(HPQ input) returns HPQ;
ceil(HPQ input) returns HPQ;
floor(HPQ input) returns HPQ;
round(HPQ input) returns HPZ;
pi() returns HPQ;
e() returns HPQ;
power(HPQ base, HPQ exponent) returns HPQ;
sqrt(HPQ input) returns HPQ
nroot(HPZ theroot, HPQ input) returns HPQ;
log10(HPQ input) returns HPQ;
loge(HPQ input) returns HPQ;
log2(HPQ input) returns HPQ;
factorial(HPZ input) returns HPZ;
nCr(HPZ objects, HPZ selectionSize) returns HPZ
nPr(HPZ objects, HPZ selectionSize) returns HPZ

degrees(HPQ input) returns HPQ;
radians(HPQ input) returns HPQ;
sind(HPQ input) returns HPQ;
cosd(HPQ input) returns HPQ;
tand(HPQ input) returns HPQ;
asind(HPQ input) returns HPQ;
acosd(HPQ input) returns HPQ;
atand(HPQ input) returns HPQ;
sinr(HPQ input) returns HPQ;
cosr(HPQ input) returns HPQ;
tanr(HPQ input) returns HPQ;
asinr(HPQ input) returns HPQ;
acosr(HPQ input) returns HPQ;
atanr(HPQ input) returns HPQ;

##########################################################################################

-Informative articles on all these things exist at:
Comparison Operators: https://en.wikipedia.org/wiki/Relational_operator
Floor and Ceiling Functions: https://en.wikipedia.org/wiki/Floor_and_ceiling_functions
Arithmetic Operations: https://en.wikipedia.org/wiki/Arithmetic
Integer Division: https://en.wikipedia.org/wiki/Division_(mathematics)#Of_integers
Modulus Operation: https://en.wikipedia.org/wiki/Modulo_operation
Rounding (Commercial Rounding): https://en.wikipedia.org/wiki/Rounding
Factorial Operation: https://en.wikipedia.org/wiki/Factorial
Degrees: https://en.wikipedia.org/wiki/Degree_(angle)
Radians: https://en.wikipedia.org/wiki/Radian
Elementary Functions: https://en.wikipedia.org/wiki/Elementary_function

-Ease of installation support. Particularly for Windows and Linux. *.exe, *.msi or *.rpm, *.deb, *.bin installers.
With a PostgreSQL standard installation.  Installation and Activation instructions included.

The following chart could be used to help test trigonometry outputs, under
Further Condsideration of the Unit Circle:
https://courses.lumenlearning.com/boundless-algebra/chapter/trigonometric-functions-and-the-unit-circle/
#############################################################################################

Improved PostgreSQL Mathematics Support.

От
A Z
Дата:
Dear PostgreSQL Hackers,

I have been trying to get a reply or interest in either updating
PostgreSQL to support High Precision mathematical types,
with arithmetic and elementary functions support, or release
of an Extension which has accomplished the same thing.

Is there someone on this email list which could please have a look
at the specifications that I have posted, and reply and get back to
me? I would be more than thrilled if something could be done
to improve PostgreSQL in this area.

Yours Sincerely,

Z.M.


Re: Improved PostgreSQL Mathematics Support.

От
"David G. Johnston"
Дата:
On Sunday, September 19, 2021, A Z <poweruserm@live.com.au> wrote:

Is there someone on this email list which could please have a look
at the specifications that I have posted, and reply and get back to
me?

Given the number of posts you’ve made I would have to conclude that the answer to that question is no.  There is presently no interest in this from the people who read these mailing lists.

David J.

Re: Improved PostgreSQL Mathematics Support.

От
"Private Information Retrieval(PIR)"
Дата:
Your request is essentially to wrap the GMP library into native types in Postgres. This can be done as custom types and adding postgres extensions as you suggested originally. The work to be done is straightforward, but there is a lot of work so it would take a awhile to implement. The big integer part is rather simple, while there is some work to be done there the fractional part will take significantly longer because reasons ( think testing edge cases), but it is doable if there is interest in implementing this.

-The MuchPIR Team


Sent with ProtonMail Secure Email.
 
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Sunday, September 19th, 2021 at 9:40 PM, A Z <poweruserm@live.com.au> wrote:
Dear PostgreSQL Hackers,

I have been trying to get a reply or interest in either updating
PostgreSQL to support High Precision mathematical types,
with arithmetic and elementary functions support, or release
of an Extension which has accomplished the same thing.

Is there someone on this email list which could please have a look
at the specifications that I have posted, and reply and get back to
me? I would be more than thrilled if something could be done
to improve PostgreSQL in this area.

Yours Sincerely,

Z.M.