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
d74b5499
Commit
d74b5499
authored
Nov 11, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'5.4', -1, HALF_UP
fixed
parent
f65e0547
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
strings/decimal.c
strings/decimal.c
+4
-4
No files found.
strings/decimal.c
View file @
d74b5499
...
@@ -867,7 +867,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
...
@@ -867,7 +867,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
error
=
E_DEC_TRUNCATED
;
error
=
E_DEC_TRUNCATED
;
}
}
if
(
scale
+
from
->
intg
<
=
0
)
if
(
scale
+
from
->
intg
<
0
)
{
{
decimal_make_zero
(
to
);
decimal_make_zero
(
to
);
return
E_DEC_OK
;
return
E_DEC_OK
;
...
@@ -881,7 +881,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
...
@@ -881,7 +881,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
buf0
=
from
->
buf
;
buf0
=
from
->
buf
;
buf1
=
to
->
buf
;
buf1
=
to
->
buf
;
to
->
sign
=
from
->
sign
;
to
->
sign
=
from
->
sign
;
to
->
intg
=
min
(
from
->
intg
,
len
*
DIG_PER_DEC1
)
;
to
->
intg
=
min
(
intg0
,
len
)
*
DIG_PER_DEC1
;
}
}
if
(
frac0
>
frac1
)
if
(
frac0
>
frac1
)
...
@@ -921,8 +921,6 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
...
@@ -921,8 +921,6 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
*
buf1
-=
DIG_BASE
;
*
buf1
-=
DIG_BASE
;
while
(
carry
&&
--
buf1
>=
to
->
buf
)
while
(
carry
&&
--
buf1
>=
to
->
buf
)
ADD
(
*
buf1
,
*
buf1
,
0
,
carry
);
ADD
(
*
buf1
,
*
buf1
,
0
,
carry
);
if
(
to
->
buf
[
0
]
>
from
->
buf
[
0
])
to
->
intg
++
;
if
(
unlikely
(
carry
))
if
(
unlikely
(
carry
))
{
{
/* shifting the number to create space for new digit */
/* shifting the number to create space for new digit */
...
@@ -937,6 +935,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
...
@@ -937,6 +935,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
buf1
[
0
]
=
buf1
[
-
1
];
buf1
[
0
]
=
buf1
[
-
1
];
}
}
*
buf1
=
1
;
*
buf1
=
1
;
to
->
intg
++
;
}
}
}
}
if
(
scale
<
0
)
scale
=
0
;
if
(
scale
<
0
)
scale
=
0
;
...
@@ -2058,6 +2057,7 @@ main()
...
@@ -2058,6 +2057,7 @@ main()
test_ro
(
"15.17"
,
1
,
HALF_UP
);
test_ro
(
"15.17"
,
1
,
HALF_UP
);
test_ro
(
"15.4"
,
-
1
,
HALF_UP
);
test_ro
(
"15.4"
,
-
1
,
HALF_UP
);
test_ro
(
"-15.4"
,
-
1
,
HALF_UP
);
test_ro
(
"-15.4"
,
-
1
,
HALF_UP
);
test_ro
(
"5.4"
,
-
1
,
HALF_UP
);
test_ro
(
"15.1"
,
0
,
HALF_EVEN
);
test_ro
(
"15.1"
,
0
,
HALF_EVEN
);
test_ro
(
"15.5"
,
0
,
HALF_EVEN
);
test_ro
(
"15.5"
,
0
,
HALF_EVEN
);
test_ro
(
"14.5"
,
0
,
HALF_EVEN
);
test_ro
(
"14.5"
,
0
,
HALF_EVEN
);
...
...
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