150
150
return copy_or_same(thd);
153
double Item_func_cos::val_real()
156
double value= args[0]->val_real();
157
if ((null_value=args[0]->null_value))
162
double Item_func_sin::val_real()
165
double value= args[0]->val_real();
166
if ((null_value=args[0]->null_value))
171
double Item_func_tan::val_real()
174
double value= args[0]->val_real();
175
if ((null_value=args[0]->null_value))
177
return fix_result(tan(value));
181
153
// Shift-functions, same as << and >> in C/C++
235
void Item_func_int_val::fix_num_length_and_dec()
237
max_length= args[0]->max_length - (args[0]->decimals ?
238
args[0]->decimals + 1 :
240
uint32_t tmp= float_length(decimals);
241
set_if_smaller(max_length,tmp);
246
void Item_func_int_val::find_num_type()
248
switch(hybrid_type= args[0]->result_type())
252
hybrid_type= REAL_RESULT;
253
max_length= float_length(decimals);
258
-2 because in most high position can't be used any digit for int64_t
259
and one position for increasing value during operation
261
if ((args[0]->max_length - args[0]->decimals) >=
262
(DECIMAL_LONGLONG_DIGITS - 2))
264
hybrid_type= DECIMAL_RESULT;
268
unsigned_flag= args[0]->unsigned_flag;
269
hybrid_type= INT_RESULT;
279
int64_t Item_func_ceiling::int_op()
282
switch (args[0]->result_type()) {
284
result= args[0]->val_int();
285
null_value= args[0]->null_value;
289
my_decimal dec_buf, *dec;
290
if ((dec= Item_func_ceiling::decimal_op(&dec_buf)))
291
my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
297
result= (int64_t)Item_func_ceiling::real_op();
303
double Item_func_ceiling::real_op()
306
the volatile's for BUG #3051 to calm optimizer down (because of gcc's
309
volatile double value= args[0]->val_real();
310
null_value= args[0]->null_value;
315
my_decimal *Item_func_ceiling::decimal_op(my_decimal *decimal_value)
317
my_decimal val, *value= args[0]->val_decimal(&val);
318
if (!(null_value= (args[0]->null_value ||
319
my_decimal_ceiling(E_DEC_FATAL_ERROR, value,
320
decimal_value) > 1)))
321
return decimal_value;
326
207
int64_t Item_func_floor::int_op()