Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
516fd425
Commit
516fd425
authored
Nov 30, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addition to fix for bug #12956: cast make differ rounding.
- use rint() in some other val_int() methods as well.
parent
b46c240b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
sql/item.cc
sql/item.cc
+2
-2
sql/item_func.h
sql/item_func.h
+2
-2
sql/item_sum.cc
sql/item_sum.cc
+3
-3
sql/item_sum.h
sql/item_sum.h
+4
-4
No files found.
sql/item.cc
View file @
516fd425
...
...
@@ -2467,7 +2467,7 @@ longlong Item_param::val_int()
{
switch
(
state
)
{
case
REAL_VALUE
:
return
(
longlong
)
(
value
.
real
+
(
value
.
real
>
0
?
0.5
:
-
0.5
)
);
return
(
longlong
)
rint
(
value
.
real
);
case
INT_VALUE
:
return
value
.
integer
;
case
DECIMAL_VALUE
:
...
...
@@ -5439,7 +5439,7 @@ void Item_cache_real::store(Item *item)
longlong
Item_cache_real
::
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
(
value
+
(
value
>
0
?
0.5
:
-
0.5
)
);
return
(
longlong
)
rint
(
value
);
}
...
...
sql/item_func.h
View file @
516fd425
...
...
@@ -199,7 +199,7 @@ public:
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
decimal_value
);
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
val_real
(
);
}
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
rint
(
val_real
()
);
}
enum
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
void
fix_length_and_dec
()
{
decimals
=
NOT_FIXED_DEC
;
max_length
=
float_length
(
decimals
);
}
...
...
@@ -943,7 +943,7 @@ class Item_func_udf_float :public Item_udf_func
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
Item_func_udf_float
::
val_real
(
);
return
(
longlong
)
rint
(
Item_func_udf_float
::
val_real
()
);
}
my_decimal
*
val_decimal
(
my_decimal
*
dec_buf
)
{
...
...
sql/item_sum.cc
View file @
516fd425
...
...
@@ -452,7 +452,7 @@ longlong Item_sum_sum::val_int()
&
result
);
return
result
;
}
return
(
longlong
)
val_real
(
);
return
(
longlong
)
rint
(
val_real
()
);
}
...
...
@@ -1285,7 +1285,7 @@ longlong Item_sum_hybrid::val_int()
return
sum_int
;
}
default:
return
(
longlong
)
Item_sum_hybrid
::
val_real
(
);
return
(
longlong
)
rint
(
Item_sum_hybrid
::
val_real
()
);
}
}
...
...
@@ -2001,7 +2001,7 @@ double Item_avg_field::val_real()
longlong
Item_avg_field
::
val_int
()
{
return
(
longlong
)
val_real
(
);
return
(
longlong
)
rint
(
val_real
()
);
}
...
...
sql/item_sum.h
View file @
516fd425
...
...
@@ -126,7 +126,7 @@ public:
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
val_real
(
);
/* Real as default */
return
(
longlong
)
rint
(
val_real
()
);
/* Real as default */
}
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
);
...
...
@@ -392,7 +392,7 @@ public:
bool
add
();
double
val_real
();
// In SPs we might force the "wrong" type with select into a declare variable
longlong
val_int
()
{
return
(
longlong
)
val_real
(
);
}
longlong
val_int
()
{
return
(
longlong
)
rint
(
val_real
()
);
}
my_decimal
*
val_decimal
(
my_decimal
*
);
String
*
val_str
(
String
*
str
);
void
reset_field
();
...
...
@@ -421,7 +421,7 @@ public:
enum
Type
type
()
const
{
return
FIELD_VARIANCE_ITEM
;
}
double
val_real
();
longlong
val_int
()
{
/* can't be fix_fields()ed */
return
(
longlong
)
val_real
(
);
}
{
/* can't be fix_fields()ed */
return
(
longlong
)
rint
(
val_real
()
);
}
String
*
val_str
(
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
is_null
()
{
(
void
)
val_int
();
return
null_value
;
}
...
...
@@ -699,7 +699,7 @@ class Item_sum_udf_float :public Item_udf_sum
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
Item_sum_udf_float
::
val_real
(
);
return
(
longlong
)
rint
(
Item_sum_udf_float
::
val_real
()
);
}
double
val_real
();
String
*
val_str
(
String
*
str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment