• Alexey Kopytov's avatar
    Backport of the patch for bug #8457 "Precision math: DIV · 425157ee
    Alexey Kopytov authored
    returns incorrect result with large decimal value" 
     
    For the DIV operator, neither operands nor result were checked 
    for integer overflows. 
     
    This patch changes the DIV behavior for non-integer operands as 
    follows: if either of the operands has a non-integer type, 
    convert both operands to the DECIMAL type, then calculate the 
    division using DECIMAL arithmetics. Convert the resulting 
    DECIMAL value into BIGINT [UNSIGNED] if it fits into the 
    corresponding range, or throw an 'out of range' error 
    otherwise. 
    425157ee
item_func.cc 155 KB