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
b0045f9e
Commit
b0045f9e
authored
Oct 31, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compare with DIG_BASE corectly
rounding bugs fixed
parent
afd18341
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
strings/decimal.c
strings/decimal.c
+5
-8
No files found.
strings/decimal.c
View file @
b0045f9e
...
...
@@ -468,7 +468,7 @@ static int ull2dec(ulonglong from, decimal *to)
sanity
(
to
);
for
(
intg1
=
1
;
from
>
DIG_BASE
;
intg1
++
,
from
/=
DIG_BASE
);
for
(
intg1
=
1
;
from
>
=
DIG_BASE
;
intg1
++
,
from
/=
DIG_BASE
);
if
(
unlikely
(
intg1
>
to
->
len
))
{
intg1
=
to
->
len
;
...
...
@@ -880,20 +880,17 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
y
=
x
%
10
;
if
(
y
>
5
||
(
y
==
5
&&
(
mode
==
HALF_UP
||
(
x
/
10
)
&
1
)))
x
+=
10
;
*
buf1
=
x
*
powers10
[
pos
]
-
y
;
*
buf1
=
powers10
[
pos
]
*
(
x
-
y
)
;
}
else
*
buf1
=
(
*
buf1
/
powers10
[
pos
+
1
])
*
powers10
[
pos
+
1
];
}
if
(
*
buf1
>
DIG_BASE
)
if
(
*
buf1
>
=
DIG_BASE
)
{
carry
=
1
;
*
buf1
-=
DIG_BASE
;
while
(
carry
&&
buf1
>=
to
->
buf
)
{
while
(
carry
&&
--
buf1
>=
to
->
buf
)
ADD
(
*
buf1
,
*
buf1
,
0
,
carry
);
buf1
--
;
}
if
(
unlikely
(
carry
))
{
/* shifting the number to create space for new digit */
...
...
@@ -1407,7 +1404,7 @@ static int do_div_mod(decimal *from1, decimal *from2,
dlen1
=
len2
;
}
guess
=
(
norm_factor
*
x
+
norm_factor
*
y
/
DIG_BASE
)
/
norm2
;
if
(
unlikely
(
guess
>
DIG_BASE
))
if
(
unlikely
(
guess
>
=
DIG_BASE
))
guess
=
DIG_BASE
-
1
;
if
(
likely
(
len2
>
1
))
{
...
...
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