<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 5:31 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Mar 3, 2015 at 5:21 PM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi All,<br><br></div>This is with reference to issue  <a href="https://github.com/numpy/numpy/issues/5626" target="_blank">#5626</a>. Currently linalg.norm converts the input like so `x = asarray(x)`. This can produce integer arrays, which in turn may create problems of overflow, or the failure of the abs functions for minimum values of signed integer types. I propose to convert the input to a minimum precision of float32. However, this will be a change in behavior. I'd guess that that might not be much of a problem, as otherwise it is likely that this problem would have been reported earlier.<br><br></div>Thoughts?<br></div></div></blockquote><div><br></div></div></div><div>Not sure if it makes sense here, but elsewhere (I think it was polyval) we let object arrays through unchanged.</div></div></div></div></blockquote><div><br></div></span><div>That would still work. I'm thinking something like<br><br></div><div><span style="font-family:monospace,monospace">x = asarray(x)<br></span></div><div><span style="font-family:monospace,monospace">dt = result_type(x, np.float32)<br></span></div><div><span style="font-family:monospace,monospace">if x.dtype.type is not dt.type:<br></span></div><div><span style="font-family:monospace,monospace">    x = x.astype(dt)</span><br><br></div></div></div></div></blockquote><div><br></div><div>I'd actually like to add a `min_dtype` keyword to asarray, We need it in several places.<br><br></div><div>Chuck <br></div></div></div></div>