Conversation
Comment on lines
+303
to
+304
| The input must have unit ``rad`` or be dimensionless. | ||
| In either case, the output is dimensionless. |
Member
There was a problem hiding this comment.
So the 1/rad one would naively get from the denominator is not included?
Member
Author
There was a problem hiding this comment.
No. I figured that since rad is just a special case of dimensionless and this is not a pure angle-based sine, it makes more sense to return the latter.
| } | ||
|
|
||
| Unit sinc(const Unit &a) { | ||
| if (a == rad || a == dimensionless) |
Member
There was a problem hiding this comment.
Do we support dimensionless in sin? What is the motivation here?
Member
Author
There was a problem hiding this comment.
My motivation was that sinc is not a pure trigonometric function and strictly sticking to rad would make it more difficult to compose sinc with other functions. I doubt that people normally consider the input or output of sinc to be dimensionful.
| constexpr auto sinc(const ValueAndVariance<T> a) noexcept { | ||
| using std::sin, std::cos; | ||
| if (a.value == 0) { | ||
| // multiply by 0 in case a.variance is NaN or inf |
SimonHeybrock
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3855
I went with the mathematics and physics definition because that is our target audience. This means that we deviate from NumPy which focusses more on signal processing in this case.