On Sat, Nov 11, 2006 at 01:59:40PM -0800, Keith Goodman wrote:
> Would it make sense to upcast instead of downcast?
>
> This upcasts:
>
> >> x = M.matrix([[1, M.nan, 3]])
> >> x
> matrix([[ 1., nan, 3.]])
>
> But this doesn't:
>
> >> x = M.matrix([[1, 2, 3]])
> >> x[0,1
On 11/11/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:
> On Sat, Nov 11, 2006 at 10:40:22AM -0800, Keith Goodman wrote:
> > I accidentally wrote a unit test using int32 instead of float64 and
> > ran into this problem:
> >
> > >> x = M.matrix([[1, 2, 3]])
> > >> x[0,1] = M.nan
> > >> x
> > mat
On Sat, Nov 11, 2006 at 06:30:06PM -0300, Lisandro Dalcin wrote:
> On 11/11/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:
> > NaN (or inf) is a floating point number, so seeing a zero in integer
> > representation seems correct:
> >
> > In [2]: int(N.nan)
> > Out[2]: 0L
> >
>
> Just to learn
On 11/11/06, Lisandro Dalcin <[EMAIL PROTECTED]> wrote:
On 11/11/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:> NaN (or inf) is a floating point number, so seeing a zero in integer> representation seems correct:
>> In [2]: int(N.nan)> Out[2]: 0L>Just to learn myself: Why int(N.nan) should be 0
On 11/11/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:
> NaN (or inf) is a floating point number, so seeing a zero in integer
> representation seems correct:
>
> In [2]: int(N.nan)
> Out[2]: 0L
>
Just to learn myself: Why int(N.nan) should be 0? Is it C behavior?
--
Lisandro DalcĂn
On Sat, Nov 11, 2006 at 10:40:22AM -0800, Keith Goodman wrote:
> I accidentally wrote a unit test using int32 instead of float64 and
> ran into this problem:
>
> >> x = M.matrix([[1, 2, 3]])
> >> x[0,1] = M.nan
> >> x
> matrix([[1, 0, 3]]) <--- Got 0 instead of NaN
>
> But this, of course, work
I accidentally wrote a unit test using int32 instead of float64 and
ran into this problem:
>> x = M.matrix([[1, 2, 3]])
>> x[0,1] = M.nan
>> x
matrix([[1, 0, 3]]) <--- Got 0 instead of NaN
But this, of course, works:
>> x = M.matrix([[1.0, 2.0, 3.0]])
>> x[0,1] = M.nan
>> x
matrix([[ 1.