MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / Register_NumericFuncs

Function Register_NumericFuncs

src/arithmetic/numeric_funcs/numeric_funcs.c:376–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376void Register_NumericFuncs() {
377 SIType *types;
378 SIType ret_type;
379 AR_FuncDesc *func_desc;
380
381 types = array_new(SIType, 1);
382 array_append(types, (SI_NUMERIC | T_STRING | T_ARRAY | T_BOOL | T_NULL));
383 ret_type = SI_NUMERIC | T_STRING | T_ARRAY | T_BOOL | T_NULL;
384 func_desc = AR_FuncDescNew("add", AR_ADD, 2, 2, types, ret_type, true, true);
385 AR_RegFunc(func_desc);
386
387 types = array_new(SIType, 1);
388 array_append(types, (SI_NUMERIC | T_NULL));
389 ret_type = SI_NUMERIC | T_NULL;
390 func_desc = AR_FuncDescNew("sub", AR_SUB, 2, 2, types, ret_type, true, true);
391 AR_RegFunc(func_desc);
392
393 types = array_new(SIType, 1);
394 array_append(types, (SI_NUMERIC | T_NULL));
395 ret_type = SI_NUMERIC | T_NULL;
396 func_desc = AR_FuncDescNew("mul", AR_MUL, 2, 2, types, ret_type, true, true);
397 AR_RegFunc(func_desc);
398
399 types = array_new(SIType, 1);
400 array_append(types, (SI_NUMERIC | T_NULL));
401 ret_type = SI_NUMERIC | T_NULL;
402 func_desc = AR_FuncDescNew("div", AR_DIV, 2, 2, types, ret_type, true, true);
403 AR_RegFunc(func_desc);
404
405 types = array_new(SIType, 1);
406 array_append(types, (SI_NUMERIC | T_NULL));
407 ret_type = SI_NUMERIC | T_NULL;
408 func_desc = AR_FuncDescNew("mod", AR_MODULO, 2, 2, types, ret_type, true, true);
409 AR_RegFunc(func_desc);
410
411 types = array_new(SIType, 1);
412 array_append(types, (SI_NUMERIC | T_NULL));
413 ret_type = SI_NUMERIC | T_NULL;
414 func_desc = AR_FuncDescNew("abs", AR_ABS, 1, 1, types, ret_type, false, true);
415 AR_RegFunc(func_desc);
416
417 types = array_new(SIType, 1);
418 array_append(types, (SI_NUMERIC | T_NULL));
419 ret_type = SI_NUMERIC | T_NULL;
420 func_desc = AR_FuncDescNew("ceil", AR_CEIL, 1, 1, types, ret_type, false, true);
421 AR_RegFunc(func_desc);
422
423 types = array_new(SIType, 1);
424 array_append(types, (SI_NUMERIC | T_NULL));
425 ret_type = SI_NUMERIC | T_NULL;
426 func_desc = AR_FuncDescNew("floor", AR_FLOOR, 1, 1, types, ret_type, false, true);
427 AR_RegFunc(func_desc);
428
429 types = array_new(SIType, 0);
430 ret_type = T_DOUBLE;
431 func_desc = AR_FuncDescNew("rand", AR_RAND, 0, 0, types, ret_type, false, false);
432 AR_RegFunc(func_desc);
433

Callers 1

AR_RegisterFuncsFunction · 0.85

Calls 2

AR_FuncDescNewFunction · 0.85
AR_RegFuncFunction · 0.85

Tested by

no test coverage detected