a type cast number -> bigint is possible: number n=....; bigint b=bigint(n);
To implement number^bigint one has to do: - implement the routine to compute it using n_Power, n_Mult, n_Delete, for the operations with the number, and n_MPZ(expoent,b,coeffs_BIGINT) to convert the bigint b to an mpz_t number (on the C/C++ side, both number and bigint have the type number) - add a line to Singular/table.h ,{D(jjPOWER_N_B), '^', NUMBER_CMD, NUMBER_CMD, BIGINT_CMD, ALLOW_NC | ALLOW_RING} - add jjPOWER_N_B so Singular/iparith.cc: static BOOLEAN jjPOWER_N_B(leftv res, leftv u, leftv v) { number e=(number)v->Data(); number n=(number)u->Data(); number r=n_Power_bigint(n,ei,currRing); res->data=(char*)r; return FALSE; }
a type cast number -> bigint is possible: number n=....; bigint b=bigint(n);
To implement number^bigint one has to do: - implement the routine to compute it using n_Power, n_Mult, n_Delete, for the operations with the number, and n_MPZ(expoent,b,coeffs_BIGINT) to convert the bigint b to an mpz_t number (on the C/C++ side, both number and bigint have the type number) - add a line to Singular/table.h ,{D(jjPOWER_N_B), '^', NUMBER_CMD, NUMBER_CMD, BIGINT_CMD, ALLOW_NC | ALLOW_RING} - add jjPOWER_N_B so Singular/iparith.cc: static BOOLEAN jjPOWER_N_B(leftv res, leftv u, leftv v) { number e=(number)v->Data(); number n=(number)u->Data(); number r=n_Power_bigint(n,ei,currRing); res->data=(char*)r; return FALSE; }
|