22#include <drizzled/function/math/mod.h>
23#include <drizzled/type/decimal.h>
35 int64_t value= args[0]->val_int();
36 int64_t val2= args[1]->val_int();
43 signal_divide_by_null();
47 if (args[0]->unsigned_flag)
48 result= args[1]->unsigned_flag ?
49 ((uint64_t) value) % ((uint64_t) val2) : ((uint64_t) value) % val2;
51 result= args[1]->unsigned_flag ?
52 (int64_t)(value % ((uint64_t) val2)) : (int64_t)(value % val2);
60 double value= args[0]->val_real();
61 double val2= args[1]->val_real();
66 signal_divide_by_null();
69 return fmod(value,val2);
78 val1= args[0]->val_decimal(&value1);
81 val2= args[1]->val_decimal(&value2);
84 switch (class_decimal_mod(E_DEC_FATAL_ERROR & ~E_DEC_DIV_ZERO, decimal_value,
90 signal_divide_by_null();
99void Item_func_mod::result_precision()
101 decimals= max(args[0]->decimals, args[1]->decimals);
102 max_length= max(args[0]->max_length, args[1]->max_length);
106void Item_func_mod::fix_length_and_dec()
108 Item_num_op::fix_length_and_dec();
110 unsigned_flag= args[0]->unsigned_flag;
double real_op()
Performs the operation that this functions implements when the result type is REAL.
type::Decimal * decimal_op(type::Decimal *)
Performs the operation that this functions implements when the result type is DECIMAL.
int64_t int_op()
Performs the operation that this functions implements when the result type is INT.
TODO: Rename this file - func.h is stupid.