-
Notifications
You must be signed in to change notification settings - Fork 401
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
tan + sin funcs #391
tan + sin funcs #391
Conversation
This comment has been minimized.
This comment has been minimized.
src/hvm.c
Outdated
@@ -570,6 +570,10 @@ static inline Numb operate(Numb a, Numb b) { | |||
case OP_AND: return new_f24(atan2f(av, bv)); | |||
case OP_OR: return new_f24(logf(bv) / logf(av)); | |||
case OP_XOR: return new_f24(powf(av, bv)); | |||
case OP_SHL: return new_f24(sin(av + bv)); | |||
case FP_SHL: return new_f24(sin(av + bv)); |
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.
We don't need to waste f24 FP_SHL and FP_SHR here
src/hvm.cu
Outdated
@@ -676,6 +676,10 @@ __device__ __host__ inline Numb operate(Numb a, Numb b) { | |||
case OP_AND: return new_f24(atan2f(av, bv)); | |||
case OP_OR: return new_f24(logf(bv) / logf(av)); | |||
case OP_XOR: return new_f24(powf(av, bv)); | |||
case OP_SHL: return new_f24(sin(av + bv)); | |||
case FP_SHL: return new_f24(sin(av + bv)); |
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
src/hvm.rs
Outdated
@@ -407,6 +407,10 @@ impl Numb { | |||
OP_AND => Numb::new_f24(av.atan2(bv)), | |||
OP_OR => Numb::new_f24(bv.log(av)), | |||
OP_XOR => Numb::new_f24(av.powf(bv)), | |||
OP_SHL => Numb::new_f24((av + bv).sin()), | |||
OP_SHR => Numb::new_f24((av + bv).tan()), | |||
FP_SHL => Numb::new_f24((av + bv).sin()), |
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.
and here
src/ast.rs
Outdated
@@ -79,6 +79,8 @@ impl<'i> CoreParser<'i> { | |||
_ if self.try_consume("&") => hvm::OP_AND, | |||
_ if self.try_consume("|") => hvm::OP_OR, | |||
_ if self.try_consume("^") => hvm::OP_XOR, | |||
_ if self.try_consume("sin") => hvm::OP_SHL, |
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.
These symbols are trying to uniquely map to operators, so we shouldn't add sin and tan here. Notice how there's no pow, log and atan2.
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.
fair enough but in the context of [
nothing else could appear there, thought it would be a bit more readable.
Perf run for
|
fixes #384