MCPcopy Create free account
hub / github.com/audacity/audacity / decimalSumStep

Function decimalSumStep

lib-src/sqlite/shell.c:4979–5004  ·  view source on GitHub ↗

Aggregate funcion: decimal_sum(X) ** ** Works like sum() except that it uses decimal arithmetic for unlimited ** precision. */

Source from the content-addressed store, hash-verified

4977** precision.
4978*/
4979static void decimalSumStep(
4980 sqlite3_context *context,
4981 int argc,
4982 sqlite3_value **argv
4983){
4984 Decimal *p;
4985 Decimal *pArg;
4986 UNUSED_PARAMETER(argc);
4987 p = sqlite3_aggregate_context(context, sizeof(*p));
4988 if( p==0 ) return;
4989 if( !p->isInit ){
4990 p->isInit = 1;
4991 p->a = sqlite3_malloc(2);
4992 if( p->a==0 ){
4993 p->oom = 1;
4994 }else{
4995 p->a[0] = 0;
4996 }
4997 p->nDigit = 1;
4998 p->nFrac = 0;
4999 }
5000 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
5001 pArg = decimal_new(context, argv[0], 0, 0);
5002 decimal_add(p, pArg);
5003 decimal_free(pArg);
5004}
5005static void decimalSumInverse(
5006 sqlite3_context *context,
5007 int argc,

Callers

nothing calls this directly

Calls 3

decimal_newFunction · 0.85
decimal_addFunction · 0.85
decimal_freeFunction · 0.85

Tested by

no test coverage detected