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
d7f6ced1
Commit
d7f6ced1
authored
Jan 12, 2004
by
vva@eagle.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Bug #2338 Trigonometric arithmetic problem
by fixing optimizer bug with help of 'volatile' keyword
parent
8a409722
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+12
-0
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+11
-0
sql/item_func.cc
sql/item_func.cc
+4
-2
No files found.
mysql-test/r/func_math.result
View file @
d7f6ced1
...
@@ -20,3 +20,15 @@ PI() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
...
@@ -20,3 +20,15 @@ PI() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
degrees(pi()) radians(360)
degrees(pi()) radians(360)
180 6.2831853071796
180 6.2831853071796
ACOS(1.0)
0.000000
ASIN(1.0)
1.570796
ACOS(0.2*5.0)
0.000000
ACOS(0.5*2.0)
0.000000
ASIN(0.8+0.2)
1.570796
ASIN(1.2-0.2)
1.570796
mysql-test/t/func_math.test
View file @
d7f6ced1
...
@@ -13,3 +13,14 @@ select pow(10,log10(10)),power(2,4);
...
@@ -13,3 +13,14 @@ select pow(10,log10(10)),power(2,4);
select
rand
(
999999
),
rand
();
select
rand
(
999999
),
rand
();
select
pi
(),
sin
(
pi
()
/
2
),
cos
(
pi
()
/
2
),
abs
(
tan
(
pi
())),
cot
(
1
),
asin
(
1
),
acos
(
0
),
atan
(
1
);
select
pi
(),
sin
(
pi
()
/
2
),
cos
(
pi
()
/
2
),
abs
(
tan
(
pi
())),
cot
(
1
),
asin
(
1
),
acos
(
0
),
atan
(
1
);
select
degrees
(
pi
()),
radians
(
360
);
select
degrees
(
pi
()),
radians
(
360
);
#
# Bug #2338 Trignometric arithmatic problems
#
SELECT
ACOS
(
1.0
);
SELECT
ASIN
(
1.0
);
SELECT
ACOS
(
0.2
*
5.0
);
SELECT
ACOS
(
0.5
*
2.0
);
SELECT
ASIN
(
0.8
+
0.2
);
SELECT
ASIN
(
1.2
-
0.2
);
sql/item_func.cc
View file @
d7f6ced1
...
@@ -456,7 +456,8 @@ double Item_func_pow::val()
...
@@ -456,7 +456,8 @@ double Item_func_pow::val()
double
Item_func_acos
::
val
()
double
Item_func_acos
::
val
()
{
{
double
value
=
args
[
0
]
->
val
();
// this 'volatile' was added as a fix for BUG #2338 to calm optimizer down
volatile
double
value
=
args
[
0
]
->
val
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
(
value
<
-
1.0
||
value
>
1.0
))))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
(
value
<
-
1.0
||
value
>
1.0
))))
return
0.0
;
return
0.0
;
return
fix_result
(
acos
(
value
));
return
fix_result
(
acos
(
value
));
...
@@ -464,7 +465,8 @@ double Item_func_acos::val()
...
@@ -464,7 +465,8 @@ double Item_func_acos::val()
double
Item_func_asin
::
val
()
double
Item_func_asin
::
val
()
{
{
double
value
=
args
[
0
]
->
val
();
// this 'volatile' was added as a fix for BUG #2338 to calm optimizer down
volatile
double
value
=
args
[
0
]
->
val
();
if
((
null_value
=
(
args
[
0
]
->
null_value
||
(
value
<
-
1.0
||
value
>
1.0
))))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
(
value
<
-
1.0
||
value
>
1.0
))))
return
0.0
;
return
0.0
;
return
fix_result
(
asin
(
value
));
return
fix_result
(
asin
(
value
));
...
...
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