[Numpy-discussion] Odd numerical difference between Numpy 1.5.1 and Numpy > 1.5.1

Charles R Harris charlesr.harris at gmail.com
Tue Apr 12 13:42:32 EDT 2011


On Tue, Apr 12, 2011 at 10:20 AM, Mark Wiebe <mwwiebe at gmail.com> wrote:

> On Tue, Apr 12, 2011 at 8:24 AM, Robert Kern <robert.kern at gmail.com>wrote:
>
>> On Mon, Apr 11, 2011 at 23:43, Mark Wiebe <mwwiebe at gmail.com> wrote:
>> > On Mon, Apr 11, 2011 at 8:48 PM, Travis Oliphant <
>> oliphant at 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:
>
>
Yep, I remember noticing that on occasion. I didn't think it was really the
right thing to do...

<snip>

Chuck

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110412/13bf5f6f/attachment.html>


More information about the NumPy-Discussion mailing list