Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-08 Thread David Goldsmith
Thanks, Sturla, you've confirmed what I thought was the case (and explained more thoroughly the answer others gave more succinctly, but also more opaquely). :-) DG On Sat, Nov 7, 2009 at 11:40 AM, Sturla Molden stu...@molden.no wrote: David Cournapeau wrote: On Fri, Nov 6, 2009 at 6:54 AM,

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-07 Thread Sturla Molden
David Cournapeau wrote: On Fri, Nov 6, 2009 at 6:54 AM, David Goldsmith d.l.goldsm...@gmail.com wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are representable using the 64-bit

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread David Goldsmith
Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are representable using the 64-bit IEEE standard for float representation (if that makes sense); and are such decimal mantissae uniformly

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread David Warde-Farley
On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are representable using the 64-bit IEEE standard for float representation (if that

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Charles R Harris
On Thu, Nov 5, 2009 at 4:26 PM, David Warde-Farley d...@cs.toronto.eduwrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread josef . pktd
On Thu, Nov 5, 2009 at 6:36 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 4:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two things: is it documented

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Charles R Harris
On Thu, Nov 5, 2009 at 7:04 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 6:36 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 4:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote:

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread josef . pktd
On Thu, Nov 5, 2009 at 9:23 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 7:04 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 6:36 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 4:26 PM, David Warde-Farley

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread David Cournapeau
On Fri, Nov 6, 2009 at 6:54 AM, David Goldsmith d.l.goldsm...@gmail.com wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site) precisely how many *decimal* mantissae are representable using the 64-bit IEEE standard for float

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Charles R Harris
On Thu, Nov 5, 2009 at 7:53 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 9:23 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 7:04 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 6:36 PM, Charles R Harris charlesr.har...@gmail.com wrote:

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Anne Archibald
2009/11/5 David Goldsmith d.l.goldsm...@gmail.com: On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two things: is it documented somewhere (e.g., at the IEEE site)

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread josef . pktd
On Thu, Nov 5, 2009 at 10:42 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two things: is it documented

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread josef . pktd
On Thu, Nov 5, 2009 at 10:28 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 7:53 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 9:23 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 5, 2009 at 7:04 PM, josef.p...@gmail.com wrote:

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Anne Archibald
2009/11/5 josef.p...@gmail.com: On Thu, Nov 5, 2009 at 10:42 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which leaves me wondering two

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread Charles R Harris
On Thu, Nov 5, 2009 at 9:14 PM, josef.p...@gmail.com wrote: On Thu, Nov 5, 2009 at 10:42 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-05 Thread David Goldsmith
On Thu, Nov 5, 2009 at 8:07 PM, Anne Archibald peridot.face...@gmail.comwrote: 2009/11/5 David Goldsmith d.l.goldsm...@gmail.com: On Thu, Nov 5, 2009 at 3:26 PM, David Warde-Farley d...@cs.toronto.edu wrote: On 5-Nov-09, at 4:54 PM, David Goldsmith wrote: Interesting thread, which

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-02 Thread Anne Archibald
2009/11/1 Thomas Robitaille thomas.robitai...@gmail.com: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats, I can use: Others have addressed why this is giving

[Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Thomas Robitaille
Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats, I can use: np.random.uniform(low=np.finfo(np.float32).min,high=np.finfo (np.float32).max,size=10) which

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Thomas Robitaille skrev: np.random.random_integers(np.iinfo(np.int32).min,high=np.iinfo (np.int32).max,size=10) which gives array([-1506183689, 662982379, -1616890435, -1519456789, 1489753527, -604311122, 2034533014, 449680073, -444302414, -1924170329]) This fails

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Thomas Robitaille wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats, I can use: np.random.uniform(low=np.finfo(np.float32).min,high=np.finfo

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 10:20 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: Thomas Robitaille wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate random 32-bit floats,

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 20:57, Thomas Robitaille thomas.robitai...@gmail.com wrote: Hi, I'm trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. 64-bit and larger integers could be done, but it requires

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
josef.p...@gmail.com wrote: array([ Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf, Inf]) might actually be the right answer if you want a uniform distribution on the real line. Does it make sense to define a uniform random variable whose range is the extended real line ? It would not

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But as of Python 2.6.4, even 32-bit integers fail, at least on

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 22:17, Sturla Molden stu...@molden.no wrote: Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Sturla Molden wrote: Robert Kern skrev: 64-bit and larger integers could be done, but it requires modification. The integer distributions were written to support C longs, not anything larger. You could also use .bytes() and np.fromstring(). But as of Python 2.6.4, even 32-bit

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. I know, but look at this: import sys sys.maxint 2147483647 2**31-1 2147483647L sys.maxint becomes a long, which is what confuses mtrand.

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread josef . pktd
On Sun, Nov 1, 2009 at 10:55 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: josef.p...@gmail.com wrote: array([ Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf,  Inf]) might actually be the right answer if you want a uniform distribution on the real line. Does it make sense

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as random_integers call randint. random_integers includes the upper range, but randint

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Sturla Molden
Sturla Molden skrev: Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as random_integers call randint. random_integers

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread Robert Kern
On Sun, Nov 1, 2009 at 23:14, Sturla Molden stu...@molden.no wrote: I'll call this a bug. Yes. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. --

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
josef.p...@gmail.com wrote: No, it wouldn't be a proper distribution. However in Bayesian analysis it is used as an improper (diffuse) prior Ah, right - I wonder how this is handled rigorously, though. I know some basics of Bayesian statistics, but I don't much about Bayesian statistics from a

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-01 Thread David Cournapeau
Sturla Molden wrote: Sturla Molden skrev: Robert Kern skrev: Then let me clarify: it was written to support integer ranges up to sys.maxint. Absolutely, it would be desirable to extend it. Actually it only supports integers up to sys.maxint-1, as