-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SQL] Add the mathematical constant PI #1123
Conversation
You should add a Fixes: line to the comments so the corresponding issue is automatically closed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am approving, but a few small changes are needed
docs/sql/float.md
Outdated
@@ -92,4 +92,8 @@ REAL '1.23' -- string style | |||
<td><code>COS(value)</code></td> | |||
<td>The cosine of value as radians. <code>cos</code> only supports argument of type double, so all other types are cast to double. Returns a double.</td> | |||
</tr> | |||
<tr> | |||
<td><code>PI</code></td> | |||
<td>Returns the approximate value of <code>PI</code> as double.</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a note that no () is required.
" sin \n" + | ||
"-----\n" + | ||
" 0.0015926529164868282\n" + | ||
" 0\n" + // Postgres disagrees with us here, but currently we round off to 15 decimal places |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this result better.
@@ -86,10 +86,10 @@ public void testSinDouble() { | |||
" 0.8414709848078965\n" + | |||
"(1 row)\n" + | |||
"\n" + | |||
"SELECT sin(CAST(3.14 AS DOUBLE));\n" + | |||
"SELECT sin(CAST(pi AS DOUBLE));\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is probably not necessary since pi is already a double.
* Also updates the sin and cos tests to use PI instead of 3.14 Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
* Remove tests that cast PI to double as PI is already double * Mention that floats are rounded off to 6 and doubles 15 decimal places in the docs Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Is this a user-visible change (yes/no): yes
Fixes: #1115