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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e98a4473
Commit
e98a4473
authored
Mar 10, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix that round(0.1,1) == round(0.1,1)
parent
21cc72bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
sql/item_func.cc
sql/item_func.cc
+13
-5
sql/slave.cc
sql/slave.cc
+4
-3
No files found.
sql/item_func.cc
View file @
e98a4473
...
@@ -679,20 +679,28 @@ double Item_func_round::val()
...
@@ -679,20 +679,28 @@ double Item_func_round::val()
double
value
=
args
[
0
]
->
val
();
double
value
=
args
[
0
]
->
val
();
int
dec
=
(
int
)
args
[
1
]
->
val_int
();
int
dec
=
(
int
)
args
[
1
]
->
val_int
();
uint
abs_dec
=
abs
(
dec
);
uint
abs_dec
=
abs
(
dec
);
double
tmp
;
/*
tmp2 is here to avoid return the value with 80 bit precision
This will fix that the test round(0.1,1) = round(0.1,1) is true
*/
volatile
double
tmp2
;
if
((
null_value
=
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
if
((
null_value
=
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
))
return
0.0
;
return
0.0
;
double
tmp
=
(
abs_dec
<
array_elements
(
log_10
)
?
tmp
=
(
abs_dec
<
array_elements
(
log_10
)
?
log_10
[
abs_dec
]
:
pow
(
10.0
,(
double
)
abs_dec
));
log_10
[
abs_dec
]
:
pow
(
10.0
,(
double
)
abs_dec
));
if
(
truncate
)
if
(
truncate
)
{
{
if
(
value
>=
0
)
if
(
value
>=
0
)
return
dec
<
0
?
floor
(
value
/
tmp
)
*
tmp
:
floor
(
value
*
tmp
)
/
tmp
;
tmp2
=
dec
<
0
?
floor
(
value
/
tmp
)
*
tmp
:
floor
(
value
*
tmp
)
/
tmp
;
else
else
return
dec
<
0
?
ceil
(
value
/
tmp
)
*
tmp
:
ceil
(
value
*
tmp
)
/
tmp
;
tmp2
=
dec
<
0
?
ceil
(
value
/
tmp
)
*
tmp
:
ceil
(
value
*
tmp
)
/
tmp
;
}
}
return
dec
<
0
?
rint
(
value
/
tmp
)
*
tmp
:
rint
(
value
*
tmp
)
/
tmp
;
else
tmp2
=
dec
<
0
?
rint
(
value
/
tmp
)
*
tmp
:
rint
(
value
*
tmp
)
/
tmp
;
return
tmp2
;
}
}
...
...
sql/slave.cc
View file @
e98a4473
...
@@ -1815,7 +1815,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
...
@@ -1815,7 +1815,8 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
if
(
init_thr_lock
()
||
thd
->
store_globals
())
if
(
init_thr_lock
()
||
thd
->
store_globals
())
{
{
end_thread
(
thd
,
0
);
thd
->
cleanup
();
delete
thd
;
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
...
@@ -2096,6 +2097,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
...
@@ -2096,6 +2097,7 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init
();
my_thread_init
();
DBUG_ENTER
(
"handle_slave_io"
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
slave_begin:
slave_begin:
...
@@ -2113,7 +2115,6 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
...
@@ -2113,7 +2115,6 @@ extern "C" pthread_handler_decl(handle_slave_io,arg)
#endif
#endif
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
DBUG_ENTER
(
"handle_slave_io"
);
THD_CHECK_SENTRY
(
thd
);
THD_CHECK_SENTRY
(
thd
);
pthread_detach_this_thread
();
pthread_detach_this_thread
();
...
@@ -2370,6 +2371,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
...
@@ -2370,6 +2371,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init
();
my_thread_init
();
DBUG_ENTER
(
"handle_slave_sql"
);
#ifndef DBUG_OFF
#ifndef DBUG_OFF
slave_begin:
slave_begin:
...
@@ -2382,7 +2384,6 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
...
@@ -2382,7 +2384,6 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg)
#ifndef DBUG_OFF
#ifndef DBUG_OFF
rli
->
events_till_abort
=
abort_slave_event_count
;
rli
->
events_till_abort
=
abort_slave_event_count
;
#endif
#endif
DBUG_ENTER
(
"handle_slave_sql"
);
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
THD_CHECK_SENTRY
(
thd
);
THD_CHECK_SENTRY
(
thd
);
...
...
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