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

Function AR_ABS

src/arithmetic/numeric_funcs/numeric_funcs.c:65–70  ·  view source on GitHub ↗

TODO All AR_* functions need to emit appropriate failures when provided * with arguments of invalid types and handle multiple arguments. */ returns the absolute value of the given number. */

Source from the content-addressed store, hash-verified

63 * with arguments of invalid types and handle multiple arguments. */
64/* returns the absolute value of the given number. */
65SIValue AR_ABS(SIValue *argv, int argc, void *private_data) {
66 SIValue result = argv[0];
67 if(SIValue_IsNull(result)) return SI_NullVal();
68 if(SI_GET_NUMERIC(argv[0]) < 0) return SIValue_Multiply(argv[0], SI_LongVal(-1));
69 return argv[0];
70}
71
72/* returns the smallest floating point number that is greater than or equal to the given number and equal to a mathematical integer. */
73SIValue AR_CEIL(SIValue *argv, int argc, void *private_data) {

Callers

nothing calls this directly

Calls 4

SIValue_IsNullFunction · 0.85
SI_NullValFunction · 0.85
SIValue_MultiplyFunction · 0.85
SI_LongValFunction · 0.85

Tested by

no test coverage detected