Addition to fix for bug #12956: cast make differ rounding.
- use rint() in some other val_int() methods as well.
This commit is contained in:
parent
6cc4218f21
commit
d54359ffda
@ -3953,7 +3953,7 @@ longlong Field_float::val_int(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
memcpy_fixed((byte*) &j,ptr,sizeof(j));
|
memcpy_fixed((byte*) &j,ptr,sizeof(j));
|
||||||
return ((longlong) j);
|
return (longlong) rint(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4241,7 +4241,7 @@ longlong Field_double::val_int(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
doubleget(j,ptr);
|
doubleget(j,ptr);
|
||||||
return ((longlong) j);
|
return (longlong) rint(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ struct Hybrid_type_traits
|
|||||||
{ val->real/= ulonglong2double(u); }
|
{ val->real/= ulonglong2double(u); }
|
||||||
|
|
||||||
virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const
|
virtual longlong val_int(Hybrid_type *val, bool unsigned_flag) const
|
||||||
{ return (longlong) val->real; }
|
{ return (longlong) rint(val->real); }
|
||||||
virtual double val_real(Hybrid_type *val) const { return val->real; }
|
virtual double val_real(Hybrid_type *val) const { return val->real; }
|
||||||
virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const;
|
virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const;
|
||||||
virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const;
|
virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const;
|
||||||
@ -1341,7 +1341,7 @@ public:
|
|||||||
{
|
{
|
||||||
return LONGLONG_MAX;
|
return LONGLONG_MAX;
|
||||||
}
|
}
|
||||||
return (longlong) (value+(value > 0 ? 0.5 : -0.5));
|
return (longlong) rint(value);
|
||||||
}
|
}
|
||||||
String *val_str(String*);
|
String *val_str(String*);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user