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
bbc26a63
Commit
bbc26a63
authored
Nov 10, 2005
by
holyfoot@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
b318ed17
c5313e8d
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
446 additions
and
1 deletion
+446
-1
mysql-test/r/type_newdecimal.result
mysql-test/r/type_newdecimal.result
+410
-0
mysql-test/t/type_newdecimal.test
mysql-test/t/type_newdecimal.test
+35
-0
strings/decimal.c
strings/decimal.c
+1
-1
No files found.
mysql-test/r/type_newdecimal.result
View file @
bbc26a63
This diff is collapsed.
Click to expand it.
mysql-test/t/type_newdecimal.test
View file @
bbc26a63
...
@@ -1051,6 +1051,41 @@ select cast(@non_existing_user_var/2 as DECIMAL);
...
@@ -1051,6 +1051,41 @@ select cast(@non_existing_user_var/2 as DECIMAL);
--
error
1427
--
error
1427
create
table
t
(
d
decimal
(
0
,
10
));
create
table
t
(
d
decimal
(
0
,
10
));
#
# Bug #14268 (bad FLOAT->DECIMAL conversion)
#
CREATE
TABLE
t1
(
my_float
FLOAT
,
my_double
DOUBLE
,
my_varchar
VARCHAR
(
50
),
my_decimal
DECIMAL
(
65
,
30
)
);
SHOW
CREATE
TABLE
t1
;
let
$max_power
=
32
;
while
(
$max_power
)
{
eval
INSERT
INTO
t1
SET
my_float
=
1.175494345
e
-
$max_power
,
my_double
=
1.175494345
e
-
$max_power
,
my_varchar
=
'1.175494345e-$max_power'
;
dec
$max_power
;
}
SELECT
my_float
,
my_double
,
my_varchar
FROM
t1
;
SELECT
CAST
(
my_float
AS
DECIMAL
(
65
,
30
)),
my_float
FROM
t1
;
SELECT
CAST
(
my_double
AS
DECIMAL
(
65
,
30
)),
my_double
FROM
t1
;
SELECT
CAST
(
my_varchar
AS
DECIMAL
(
65
,
30
)),
my_varchar
FROM
t1
;
UPDATE
t1
SET
my_decimal
=
my_float
;
SELECT
my_decimal
,
my_float
FROM
t1
;
UPDATE
t1
SET
my_decimal
=
my_double
;
SELECT
my_decimal
,
my_double
FROM
t1
;
UPDATE
t1
SET
my_decimal
=
my_varchar
;
SELECT
my_decimal
,
my_varchar
FROM
t1
;
DROP
TABLE
t1
;
#
#
# Bug #13573 (Wrong data inserted for too big values)
# Bug #13573 (Wrong data inserted for too big values)
#
#
...
...
strings/decimal.c
View file @
bbc26a63
...
@@ -973,7 +973,7 @@ int double2decimal(double from, decimal_t *to)
...
@@ -973,7 +973,7 @@ int double2decimal(double from, decimal_t *to)
{
{
/* TODO: fix it, when we'll have dtoa */
/* TODO: fix it, when we'll have dtoa */
char
s
[
400
],
*
end
;
char
s
[
400
],
*
end
;
sprintf
(
s
,
"%
f
"
,
from
);
sprintf
(
s
,
"%
.16G
"
,
from
);
end
=
strend
(
s
);
end
=
strend
(
s
);
return
string2decimal
(
s
,
to
,
&
end
);
return
string2decimal
(
s
,
to
,
&
end
);
}
}
...
...
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