On Mon, Feb 4, 2008 at 10:34 AM, Stuart Brorson <[EMAIL PROTECTED]> wrote:

> Hi --
>
> I'm fiddling with NumPy's chopping and truncating operators: round,
> fix, ceil, and floor.   In the case where they are passed real args,
> they work just fine.  However, I find that when they are passed
> complex args, I get the following:
>
> round -> works fine.
> ceil  -> throws exception: 'complex' object has no attribute 'ceil'
> floor -> throws exception: 'complex' object has no attribute 'floor'
> fix   -> throws exception: 'complex' object has no attribute 'floor'
>
> Please see the session log below for more details.
>
> My question:  Is this a bug or a feature?  It seems to me that if you
> implement round for complex args, then you need to also support ceil,
> floor, and fix for complex args, so it's a bug.  But I thought I'd ask
> the developers what they thought before filing a ticket.


IMO, the problem is not that ceil, floor and fix are not defined for
complex, but rather that round is. (Re, Im) is not a unique representation
for complex numbers, although that is the internal representation that numpy
uses, and as a result none of these functions are uniquely defined. Since
it's trivial to synthesize the effect that I assume you are looking for
(operating on both the Re and Im parts as if the were floats), there's no
reason to have this functionality built in.

[....examples....]


-- 
.  __
.   |-\
.
.  [EMAIL PROTECTED]
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to