R
R
Robotex2011-03-28 20:45:50
C++ / C#
Robotex, 2011-03-28 20:45:50

Exponentiation in GMP (gmpxx)?

Actually how? I can't find anything in the manual.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
E
ENargit, 2011-03-28
@ENargit

This function should work for you:
void mpf_pow_ui (mpf_t rop, mpf_t op1, unsigned long int op2)

E
ENargit, 2011-03-28
@ENargit

yes, but here's the problem... the exponent is larger than it fits in unsigned long? You can try to calculate the degree through the exponent of the logarithm

E
ENargit, 2011-03-28
@ENargit

As for the exponent of the logarithm, I got excited, I do not find suitable functions.
By the way, converting mpz to ui is not difficult at all:
unsigned long int mpz_get_ui (mpz_t op)
This is if, for example, for a report, it will be necessary to display intermediate calculations - in order to display the result of raising to a power without even taking the modulo. Although I don't think you need it.

R
Robotex, 2011-03-28
@Robotex

And how to create a dynamic array mpz_class?

R
Robotex, 2011-03-29
@Robotex

That's just something it doesn't work: pastebin.com/6XQrMTdp
Doesn't work at all - I enter values ​​into numbers, check, but they are incorrect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question