-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Define round for complex numbers #8291
Conversation
0041809
to
b5e4474
Compare
I'd be inclined to include only complex |
In addition to And there we enter a slippery slope... If we accept I would not be averse to having |
6c7c7e3
to
1a4c02f
Compare
@simonbyrne's more recent work on exposing The C99 standard actually specifies separate rounding modes for the real and imaginary components, which seems a little odd at first, but I think is the only reasonable thing to do and is also what @eschnett has proposed. |
a80d2a5
to
d3b3b79
Compare
Following what we do now for real numbers, I've exposed 3 different
The last method, together with |
This seems like a reasonable approach. |
Returns the nearest integral value of the same type as ``x`` to ``x``, | ||
breaking ties using the specified :obj:`RoundingMode`. | ||
|
||
.. function:: round(z, RoundingMode1, RoundingMode2) |
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 think the signature should rather be
round(z, RoundingModeReal, RoundingModeImaginary)
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.
+1
Defines new round methods on Complex numbers: - The "expert" rounding mode aware round(z, RoundingMode, RoundingMode) which takes separate RoundingModes for real and imaginary components - The basic round(z) which applies round to the real and imaginary components separately using the current global rounding mode - round(z, d, b) for rounding the real and imaginary components separately to d digits each in base b. Also defines float(z). These methods are sufficient to also allow for round(Array{Complex}) to work.
d3b3b79
to
4f97dcf
Compare
Define round for complex numbers
No description provided.