
Hi All, I've put up a preliminary PR <https://github.com/numpy/numpy/pull/8190> for the proposed fpower ufunc. Apart from adding more tests and documentation, I'd like to settle a few other things. The first is the name, two names have been proposed and we should settle on one - fpower (short) - float_power (obvious) The second thing is the minimum precision. In the preliminary version I have used float32, but perhaps it makes more sense for the intended use to make the minimum precision float64 instead. Thoughts? Chuck

On Thu, Oct 20, 2016 at 7:58 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
+0.6 for float_power
Can you elaborate on what you're thinking? I guess this is because float32 has limited range compared to float64, so is more likely to see overflow? float32 still goes up to 10**38 which is < int64_max**2, FWIW. Or maybe there's some subtlety with the int->float casting here? -n -- Nathaniel J. Smith -- https://vorpus.org

On Thu, Oct 20, 2016 at 9:11 PM, Nathaniel Smith <njs@pobox.com> wrote:
logical, (u)int8, (u)int16, and float16 get converted to float32, which is probably sufficient to avoid overflow and such. My thought was that float32 is something of a "specialized" type these days, while float64 is the standard floating point precision for everyday computation. Chuck

On Fri, Oct 21, 2016 at 1:45 AM, Sebastian Berg <sebastian@sipsolutions.net> wrote:
Hmm... The best way to do that would be to put the function in `fromnumeric` and do it in python rather than as a ufunc, then for integer types call power with `dtype=float64`. I like that idea better than the current implementation, my mind was stuck in the ufunc universe. Chuck

On Thu, Oct 20, 2016 at 7:58 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
+0.6 for float_power
Can you elaborate on what you're thinking? I guess this is because float32 has limited range compared to float64, so is more likely to see overflow? float32 still goes up to 10**38 which is < int64_max**2, FWIW. Or maybe there's some subtlety with the int->float casting here? -n -- Nathaniel J. Smith -- https://vorpus.org

On Thu, Oct 20, 2016 at 9:11 PM, Nathaniel Smith <njs@pobox.com> wrote:
logical, (u)int8, (u)int16, and float16 get converted to float32, which is probably sufficient to avoid overflow and such. My thought was that float32 is something of a "specialized" type these days, while float64 is the standard floating point precision for everyday computation. Chuck

On Fri, Oct 21, 2016 at 1:45 AM, Sebastian Berg <sebastian@sipsolutions.net> wrote:
Hmm... The best way to do that would be to put the function in `fromnumeric` and do it in python rather than as a ufunc, then for integer types call power with `dtype=float64`. I like that idea better than the current implementation, my mind was stuck in the ufunc universe. Chuck
participants (3)
-
Charles R Harris
-
Nathaniel Smith
-
Sebastian Berg