[issue36228] Support coercion of complex to float/int

2019-03-25 Thread Mark Dickinson
Mark Dickinson added the comment: @nagayev I applaud your enthusiasm here, but multiple core developers have already rejected your suggestions in this discussion. Given that, it would probably not be a great use of your time to pursue this. Maybe you could take a look around the bug tracker

[issue36228] Support coercion of complex to float/int

2019-03-22 Thread Марат Нагаев
Марат Нагаев added the comment: ping @tim.peters -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36228] Support coercion of complex to float/int

2019-03-09 Thread Марат Нагаев
Марат Нагаев added the comment: Can I implement this methods? @tim.peters -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Fredrik Johansson
Fredrik Johansson added the comment: I can think of two reasons to extend floor() and ceil() to complex numbers, and they lead to different extensions. The first is as a way to map complex numbers to nearby Gaussian integers by defining floor(z) = floor(z.real) + floor(z.imag)*1j, etc.

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Tim Peters
Tim Peters added the comment: I have no use for this either, and agree with rejecting it - in nearly 30 years, nobody has asked for this before, and it's still the case that we don't have an actual programming use case (some theoretical use in an abstract mathematical model isn't a

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: I think at bank. I find post (Russian) about complex numbers: https://cyberleninka.ru/article/v/primenenie-kompleksnyh-chisel-v-finansovyh-operatsiyah And rounding was used. Sorry, I don't know about English version of this article. --

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Mark Dickinson
Mark Dickinson added the comment: > Maybe the best solution is to add functions floor and ceil to cmath module You say "solution", but what problem would this be a solution to? So far, I don't think there's a demonstrated need to have this functionality. What is it useful for? So IMO, the

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: >For those rare cases where this is needed, it isn't that hard to spell out >`complex(floor(z.real) But in Python we have math.tau. However it's just 2*pi. >`math.floor` of a `float` object returns an `int` Maybe the best solution is to add functions floor and

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Mark Dickinson
Mark Dickinson added the comment: > So I suggest: > 1. Methods __floor__ and __ceil__ for complex object. What's the use-case for these? It's not a particularly natural operation, and I've never had a need for a complex "floor" operation, either as a mathematician or as a developer. Do you

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: Oh, __floor__ can return anything. So I suggest: 1. Methods __floor__ and __ceil__ for complex object. 2. Don't change __float__ and __int__ methods. 3. So I think it isn't nessesary to add methods floor and ceil to complex module. Example: from math import *

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Марат Нагаев
Марат Нагаев added the comment: I think math.floor should raise TypeError if complex argument passed, but we need cmath.floor(and ceil). As I know floor complex number is just floor real part and floor imag. Example: z=1.1+2.5j floor(z) #2+3j I think it's correct. But I don't know about complex

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Mark Dickinson
Mark Dickinson added the comment: Agreed with the closure. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Zachary Ware
Zachary Ware added the comment: Agreed with Josh and closing the issue as rejected. I'm adding our math experts just in case they disagree or want to provide further clarity. -- components: +Interpreter Core -Extension Modules, Library (Lib) nosy: +lemburg, mark.dickinson,

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Add function to complex object -> Support coercion of complex to float/int ___ Python tracker ___