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
184cbf6d
Commit
184cbf6d
authored
Dec 27, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strings/decimal.c
test_d2b2d("123.4", 10, 2, "123.40");
parent
afc9c812
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
strings/decimal.c
strings/decimal.c
+10
-2
No files found.
strings/decimal.c
View file @
184cbf6d
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#line __LINE__ "decimal.c"
/*
/*
=======================================================================
=======================================================================
NOTE: this library implements SQL standard "exact numeric" type
NOTE: this library implements SQL standard "exact numeric" type
...
@@ -680,8 +682,12 @@ int decimal2bin(decimal *from, char *to, int precision, int frac)
...
@@ -680,8 +682,12 @@ int decimal2bin(decimal *from, char *to, int precision, int frac)
/* frac1x part */
/* frac1x part */
if
(
frac1x
)
if
(
frac1x
)
{
{
int
i
=
dig2bytes
[
frac1x
];
dec1
x
;
dec1
x
=
(
*
buf1
/
powers10
[
DIG_PER_DEC1
-
frac1x
])
^
mask
;
int
i
=
dig2bytes
[
frac1x
],
lim
=
(
frac1
<
frac0
?
DIG_PER_DEC1
:
frac0x
);
while
(
frac1x
<
lim
&&
dig2bytes
[
frac1x
]
==
i
)
frac1x
++
;
x
=
(
*
buf1
/
powers10
[
DIG_PER_DEC1
-
frac1x
])
^
mask
;
switch
(
i
)
switch
(
i
)
{
{
case
1
:
mi_int1store
(
to
,
x
);
break
;
case
1
:
mi_int1store
(
to
,
x
);
break
;
...
@@ -2087,6 +2093,8 @@ main()
...
@@ -2087,6 +2093,8 @@ main()
test_d2b2d
(
"-.000000012345000098765"
,
30
,
20
,
"-.00000001234500009876"
);
test_d2b2d
(
"-.000000012345000098765"
,
30
,
20
,
"-.00000001234500009876"
);
test_d2b2d
(
"1234500009876.5"
,
30
,
5
,
"1234500009876.50000"
);
test_d2b2d
(
"1234500009876.5"
,
30
,
5
,
"1234500009876.50000"
);
test_d2b2d
(
"111111111.11"
,
10
,
2
,
"11111111.11"
);
test_d2b2d
(
"111111111.11"
,
10
,
2
,
"11111111.11"
);
full
=
1
;
test_d2b2d
(
"123.4"
,
10
,
2
,
"123.40"
);
printf
(
"==== decimal_cmp ====
\n
"
);
printf
(
"==== decimal_cmp ====
\n
"
);
test_dc
(
"12"
,
"13"
,
-
1
);
test_dc
(
"12"
,
"13"
,
-
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