Lines Matching defs:pA
4008 ** pA!=0
4009 ** pA->isNull==0
4013 static int decimal_cmp(const Decimal *pA, const Decimal *pB){
4015 if( pA->sign!=pB->sign ){
4016 return pA->sign ? -1 : +1;
4018 if( pA->sign ){
4019 const Decimal *pTemp = pA;
4020 pA = pB;
4023 nASig = pA->nDigit - pA->nFrac;
4028 n = pA->nDigit;
4030 rc = memcmp(pA->a, pB->a, n);
4032 rc = pA->nDigit - pB->nDigit;
4048 Decimal *pA = 0, *pB = 0;
4052 pA = decimal_new(context, argv[0], 1);
4053 if( pA==0 || pA->isNull ) goto cmp_done;
4056 rc = decimal_cmp(pA, pB);
4061 decimal_free(pA);
4094 ** Add the value pB into pA. A := A + B.
4096 ** Both pA and pB might become denormalized by this routine.
4098 static void decimal_add(Decimal *pA, Decimal *pB){
4101 if( pA==0 ){
4104 if( pA->oom || pB==0 || pB->oom ){
4105 pA->oom = 1;
4108 if( pA->isNull || pB->isNull ){
4109 pA->isNull = 1;
4112 nSig = pA->nDigit - pA->nFrac;
4113 if( nSig && pA->a[0]==0 ) nSig--;
4117 nFrac = pA->nFrac;
4120 decimal_expand(pA, nDigit, nFrac);
4122 if( pA->oom || pB->oom ){
4123 pA->oom = 1;
4125 if( pA->sign==pB->sign ){
4128 int x = pA->a[i] + pB->a[i] + carry;
4131 pA->a[i] = x - 10;
4134 pA->a[i] = x;
4140 rc = memcmp(pA->a, pB->a, nDigit);
4143 aB = pA->a;
4144 pA->sign = !pA->sign;
4146 aA = pA->a;
4152 pA->a[i] = x+10;
4155 pA->a[i] = x;
4171 static void decimalMul(Decimal *pA, Decimal *pB){
4176 if( pA==0 || pA->oom || pA->isNull
4181 acc = sqlite3_malloc64( pA->nDigit + pB->nDigit + 2 );
4183 pA->oom = 1;
4186 memset(acc, 0, pA->nDigit + pB->nDigit + 2);
4187 minFrac = pA->nFrac;
4189 for(i=pA->nDigit-1; i>=0; i--){
4190 signed char f = pA->a[i];
4201 sqlite3_free(pA->a);
4202 pA->a = acc;
4204 pA->nDigit += pB->nDigit + 2;
4205 pA->nFrac += pB->nFrac;
4206 pA->sign ^= pB->sign;
4207 while( pA->nFrac>minFrac && pA->a[pA->nDigit-1]==0 ){
4208 pA->nFrac--;
4209 pA->nDigit--;
4220 Decimal *pA = 0; /* The result to be returned */
4223 pA = decimalNewFromText("1.0", 3);
4224 if( pA==0 || pA->oom ) goto pow2_fault;
4225 if( N==0 ) return pA;
4235 decimalMul(pA, pX);
4236 if( pA->oom ) goto pow2_fault;
4243 return pA;
4246 decimal_free(pA);
4258 Decimal *pA;
4292 pA = decimalNewFromText(zNum, (int)strlen(zNum));
4294 decimalMul(pA, pX);
4296 return pA;
4339 Decimal *pA = decimalNewFromText((const char*)zA, nKey1);
4343 if( pA==0 || pB==0 ){
4346 rc = decimal_cmp(pA, pB);
4348 decimal_free(pA);
4365 Decimal *pA = decimal_new(context, argv[0], 1);
4368 decimal_add(pA, pB);
4369 decimal_result(context, pA);
4370 decimal_free(pA);
4378 Decimal *pA = decimal_new(context, argv[0], 1);
4383 decimal_add(pA, pB);
4384 decimal_result(context, pA);
4386 decimal_free(pA);
4459 Decimal *pA = decimal_new(context, argv[0], 1);
4462 if( pA==0 || pA->oom || pA->isNull
4467 decimalMul(pA, pB);
4468 if( pA->oom ){
4471 decimal_result(context, pA);
4474 decimal_free(pA);
4490 Decimal *pA = decimalPow2(sqlite3_value_int(argv[0]));
4491 decimal_result_sci(context, pA);
4492 decimal_free(pA);