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

Function AR_DIV

src/arithmetic/numeric_funcs/numeric_funcs.c:40–49  ·  view source on GitHub ↗

returns the division of given values. */

Source from the content-addressed store, hash-verified

38
39/* returns the division of given values. */
40SIValue AR_DIV(SIValue *argv, int argc, void *private_data) {
41 if(SIValue_IsNull(argv[0]) || SIValue_IsNull(argv[1])) return SI_NullVal();
42
43 // check for division by zero e.g. n / 0
44 if((SI_TYPE(argv[0]) & SI_TYPE(argv[1]) & T_INT64) && SI_GET_NUMERIC(argv[1]) == 0) {
45 Error_DivisionByZero();
46 return SI_NullVal();
47 }
48 return SIValue_Divide(argv[0], argv[1]);
49}
50
51SIValue AR_MODULO(SIValue *argv, int argc, void *private_data) {
52 if(SIValue_IsNull(argv[0]) || SIValue_IsNull(argv[1])) return SI_NullVal();

Callers

nothing calls this directly

Calls 4

SIValue_IsNullFunction · 0.85
SI_NullValFunction · 0.85
Error_DivisionByZeroFunction · 0.85
SIValue_DivideFunction · 0.85

Tested by

no test coverage detected