-
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 hyperbolic functions #1280
Conversation
1.5430806348152437 | ||
(1 row) | ||
|
||
SELECT coth(0.6); -- not tested in Spark |
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.
why not?
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.
It isn't available in Spark.
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 would have said "not available in Spark"
#[inline(always)] | ||
pub fn sec_d(value: F64) -> F64 { | ||
let cos = value.into_inner().cos(); | ||
if cos.is_zero() { |
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.
Rust doesn't have sec?
Also, if you just do the division with 0 don't you get the same result?
Or maybe the result can be -infinity sometimes?
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.
Actually yeah, its Infinity even if we divide by 0. I was expecting a division by 0 error, but turns out it gives inf
if the number being divided is positive and -inf
if the number being divided is negative.
if tanh.is_zero() { | ||
f64::INFINITY.into() | ||
} else { | ||
(1.0 / tanh).into() |
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.
same question about division
pub fn atanh_d(value: F64) -> F64 { | ||
let inner = value.into_inner(); | ||
if !(-1.0..=1.0).contains(&inner) && !inner.is_nan() { | ||
panic!("input out of range") |
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.
the error message should probably be more informative, including the actual value and the range.
we'll also add position at some point.
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.
Ah okay, will add the value to the error message.
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
* Remove unnecessary check for zero Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
71f3414
to
78635db
Compare
Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
Did proptest find a bug here? |
Is this a user-visible change (yes/no): yes
Partially fixes: #1265