Re: [Numpy-discussion] unexpected downcast

2008-02-13 Thread Christopher Barker
Robert Kern wrote:
 That's just what asfarray is designed to do. If you don't give it a dtype, it 
 uses float64.

For the record, it upcasts float32 arrays also.

So why does it exist at all? Is is just syntactic sugar for:

asarray(a, dtype=float64)

Which kind of seems to be not worth it.

If, on the other hand, it meant:

make this a floating point array, but keep the input precision if it's 
already a float type, that could be useful (and not completely trivial 
to write yourself).

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

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


Re: [Numpy-discussion] unexpected downcast

2008-02-13 Thread Robert Kern
Alan G Isaac wrote:
 On Tue, 12 Feb 2008, dmitrey apparently wrote:
 from numpy import * 
 a = array((1.0, 2.0), float128)
 b=asfarray(a)
 type(a[0])
 #type 'numpy.float128' 
 type(b[0])
 #type 'numpy.float64' 
  __version__
 '1.0.5.dev4767'
 
 
 Dmitrey noted an unexpected down cast (above).
 Is there a reason for it?

That's just what asfarray is designed to do. If you don't give it a dtype, it 
uses float64. Changing it would be a redesign of the function that may break 
code. The amount of code is probably minimal, so I'm only -0 on changing it.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion