void* decQuadLog10 (void* _0, const void* _1, decContext* ctx) noexcept { decNumber _0num; decNumber _1num; decQuadToNumber (_1, &_1num); decNumberLog10 (&_0num, &_1num, ctx); return decQuadFromNumber (_0, &_0num, ctx); }
void* decQuadPower (void* _0, const void* _1, const void* _2, decContext* ctx) noexcept { decNumber _0num; decNumber _1num; decNumber _2num; decQuadToNumber (_1, &_1num); decQuadToNumber (_2, &_2num); decNumberPower (&_0num, &_1num, &_2num, ctx); return decQuadFromNumber (_0, &_0num, ctx); }
int main(int argc, char *argv[]) { decQuad a; // working decQuad decNumber numa, numb; // working decNumbers decContext set; // working context char string[DECQUAD_String]; // number->string buffer if (argc<3) { // not enough words printf("Please supply two numbers for power(2*a, b).\n"); return 1; } decContextDefault(&set, DEC_INIT_DECQUAD); // initialize decQuadFromString(&a, argv[1], &set); // get a decQuadAdd(&a, &a, &a, &set); // double a decQuadToNumber(&a, &numa); // convert to decNumber decNumberFromString(&numb, argv[2], &set); decNumberPower(&numa, &numa, &numb, &set); // numa=numa**numb decQuadFromNumber(&a, &numa, &set); // back via a Quad decQuadToString(&a, string); // .. printf("power(2*%s, %s) => %s\n", argv[1], argv[2], string); return 0; } // main