|
From: Sasha <nd...@ma...> - 2006-02-23 04:48:12
|
On 2/22/06, Robert Kern <rob...@gm...> wrote:
> Sasha wrote:
> > ... wouldn't it
> > be more natural if fllor and ceil return the argument unchanged (maybe
> > a copy) if it is already integer?
>
> Only if floor() and ceil() returned integer arrays when given floats as i=
nput. I
> presume there are good reasons for this, since it's the same behavior as =
the
> standard C functions.
C does not have ceil(int). It has
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
and neither of these functions change the type of the argument.
Numpy's "around" is a noop on integers (even for decimals<0, but
that's a different story.
I cannot really think of any reason for the current numpy behaviour
other than the consistency with transcendental functions. Speaking of
which, can someone explain this:
>>> sin(array(1,'h')).dtype
dtype('<f4')
>>> sin(array(1,'i')).dtype
dtype('<f8')
|