Question about new C and PostgreSQL High Precision types.
A Z
poweruserm at live.com.au
Tue Aug 24 05:47:34 UTC 2021
I am trying to start a volunteer project to get someone to program an extension
for Postgresql, in C, on any major platoform, to provide
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-Integer (mpz) Z, or Rational Decimal Q (mpq) numbers support.
The fact is that recurring Rational Numbers and recurring Irrational Numbers can be appropriately
truncated, by a precision value, to obtain an approximating value, a finite Rational
value, with integer and decimal parts at the same time.
-A defaulting number of significant figures (precision), say, 50, and a constructor for otherwise.
mpz(1000) or mpq(1000), or mpz, mpq just on their own, with no more specified.
-Value assignment by =. The ability to specify type without any text data in a constructor.
-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.
-When operating on two multiprecision numbers, you take the largest precision of the two,
by default, for the precision of the result. If this precision is not large enough for the
meaningful result, in terms of all integer places and at least one decimal place, there should be
a precision exception. Because of this, you need the option to learn of and enlarge the larger
of the two precisions, and to try again. And of course an exception catching block.
setPrecision(mpq value1, mpz getPrecision(mpq value1) + 1);
setPrecision(mpz value2, mpz getPrecision(mpz value2) + 1);
-Mathematical and Operational functions support:
cast(text as mpz) returns mpz;
cast(text as mpq) returns mpq;
cast(mpq as text) returns text;
cast(mpz as text) returns text;
cast(mpz as mpq) returns mpq;
cast(mpq as mpz) returns mpz;
getPrecision(mpz input) returns mpw output;
getPrecision(mpq input) returns mpz output;
setPrecision(mpz value, mpz precision);
setPrecision(mpz value, mpz precision);
sign(mpq input) returns mpq;
abs(mpq input) returns mpq;
ceil(mpq input) returns mpq;
floor(mpq input) returns mpq;
round(mpq input) returns mpz;
pi(mpz places) returns mpq;
e(mpz places) returns mpq;
power(mpq base, mpq exponent) returns mpq;
sqrt(mpq input) returns mpq
nroot(mpz theroot, mpq input) returns mpq;
log10(mpq input) returns mpq;
loge(mpq input) returns mpq;
log2(mpq input) returns mpq;
factorial(mpz input) returns mpz;
degrees(mpq input) returns mpq;
radians(mpq input) returns mpq;
sind(mpq input) returns mpq;
cosd(mpq input) returns mpq;
tand(mpq input) returns mpq;
asind(mpq input) returns mpq;
acosd(mpq input) returns mpq;
atand(mpq input) returns mpq;
sinr(mpq input) returns mpq;
cosr(mpq input) returns mpq;
tanr(mpq input) returns mpq;
asinr(mpq input) returns mpq;
acosr(mpq input) returns mpq;
atanr(mpq input) returns mpq;
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
Factorial Operation: https://en.wikipedia.org/wiki/Factorial
Comparison Operators: https://en.wikipedia.org/wiki/Relational_operator
Degrees: https://en.wikipedia.org/wiki/Degree_(angle)
Radians: https://en.wikipedia.org/wiki/Radian
Elementary Functions: https://en.wikipedia.org/wiki/Elementary_function
-Another idea, might it be a good idea to turn mpz and mpq into MPZ and MPQ, to line up with the use of other
types in PostgreSQL?
-Ease of installation support. Particularly for Windows and Linux. *.exe, *.msi or *.rpm, *.deb, *.bin installers.
With a PostgreSQL standard installation.
The following chart could be used to help test trigonometry outputs:
https://www.livingston.org/cms/lib9/NJ01000562/Centricity/Domain/742/calc/Trig%20functions%20chart%20-%20answers.pdf
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is there anyone at gmp who knows enough about gmp, C, and multiplatform PostgreSQL and extentions
who could volunteer for this project?
More information about the gmp-discuss
mailing list