On Tue, Apr 12, 2011 at 11:20, Mark Wiebe <
mwwiebe@gmail.com> wrote:
> On Tue, Apr 12, 2011 at 8:24 AM, Robert Kern <
robert.kern@gmail.com> wrote:
>>
>> On Mon, Apr 11, 2011 at 23:43, Mark Wiebe <
mwwiebe@gmail.com> wrote:
>> > On Mon, Apr 11, 2011 at 8:48 PM, Travis Oliphant
>> > <
oliphant@enthought.com>
>> > wrote:
>>
>> >> It would be good to see a simple test case and understand why the
>> >> boolean
>> >> multiplied by the scalar double is becoming a float16. In other
>> >> words,
>> >> why does
>> >> (1-test)*t
>> >> return a float16 array
>> >> This does not sound right at all and it would be good to understand why
>> >> this occurs, now. How are you handling scalars multiplied by arrays
>> >> in
>> >> general?
>> >
>> > The reason it's float16 is that the first function in the multiply
>> > function
>> > list for which both types can be safely cast to the output type,
>>
>> Except that float64 cannot be safely cast to float16.
>
> That's true, but it was already being done this way with respect to float32.
> Rereading the documentation for min_scalar_type, I see the explanation could
> elaborate on the purpose of the function further. Float64 cannot be safely
> cast to float32, but this is what NumPy does:
>>>> import numpy as np
>>>> np.__version__
> '1.4.1'
>>>> np.float64(3.5) * np.ones(2,dtype=np.float32)
> array([ 3.5, 3.5], dtype=float32)
>>>>