[SciPy-dev] Question about 64-bit integers being cast to double precision

Travis Oliphant oliphant at ee.byu.edu
Fri Oct 28 16:50:43 CDT 2005

Fernando Perez wrote:

>Charles R Harris wrote:
>>Yes, I agree with this. The only problem I see is if someone wants to save
>>space when taking the sqrt of an integral array. There are at least three
>>1. cast the result to a float
>>2. cast the argument to a float
>>3. use a special sqrtf function
>>The first two options use more temporary space, take more time, and look
>>uglier (IMHO). On the other hand, the needed commands are already
>>implemented. The last option is clear and concise, but needs a new ufunc.
>Well, while I agree with the recently posted design guideline from Guido of 
>using different functions for different purposes rather than flags, this may 
>be a case where a flag would be a good choice.  Especially because we already 
>have a conceptual precedent for the accumulators of specifying the return type 
>via a flag: a.sum(rtype=int).
>Since the 'mental slot' is already in scipy's users heads for saying 'modify 
>the default output of this function to accumulate/store data in a different 
>type', I think it would be reasonable to offer
One thing we could do is take advantage of the "indexing capabilities" 
of the ufunc object which are unused at the moment and do something like


Where the argument to the index would be the desired output type or 


More information about the Scipy-dev mailing list