Re: [Tutor] largest and smallest numbers

2007-10-15 Thread Kent Johnson
Dick Moores wrote: > I pinched it down some more (after dinner): > > >>> 1.79769313486e+308 * (1.001 ** 1160) > 1.7976931348623151e+308 > >>> 1.79769313486e+308 * (1.001 ** 1161) > 1.#INF This looks promising: In [8]: x=1.7976931348623157e+308 In [9]: y=0.000

Re: [Tutor] largest and smallest numbers

2007-10-14 Thread Dick Moores
At 06:01 PM 9/24/2007, Terry Carroll wrote: >On Mon, 24 Sep 2007, Christopher Spears wrote: > > > How can I find the largest float and complex numbers? > >That's an interesting question.. > >I just tried this: > >x = 2.0 >while True: > x = x*2 > print x > if repr(x) == "1.#INF": break >

Re: [Tutor] largest and smallest numbers

2007-10-07 Thread Kent Johnson
Christopher Spears wrote: > One of the exercises from Core Python Programmng (2nd > Edition) asks me to determine the largest and smallest > integers, float, and complex numbers my system can > handle. Using python.org and Google, I have > discovered my system's largest and smallest ingtegers: >

Re: [Tutor] largest and smallest numbers (Linpeiheng)

2007-09-25 Thread Noufal Ibrahim
林培恒 wrote: > On Mon, 24 Sep 2007, Terry Carroll write: > >> My math is rusty. Is there a concept of "greater than" >> or "largest" in complex numbers on different axis? Which >> is larger, 4+2i or 2+4i? > > In fact, complex numbers can not compare directly. People always compare > complex numbe

Re: [Tutor] largest and smallest numbers

2007-09-25 Thread Terry Carroll
On Tue, 25 Sep 2007, John Fouhy wrote: > You've got upper and lower bounds - maybe you could do a binary search > to find the max exactly? It should only take the same number of steps > again... I thought of that; and then I thought I'd rather go home and have dinner. ___

Re: [Tutor] largest and smallest numbers (Linpeiheng)

2007-09-25 Thread 林培恒
On Mon, 24 Sep 2007, Terry Carroll write: >My math is rusty. Is there a concept of "greater than" >or "largest" in complex numbers on different axis? Which >is larger, 4+2i or 2+4i? In fact, complex numbers can not compare directly. People always compare complex numbers with their 'model'. For

Re: [Tutor] largest and smallest numbers

2007-09-25 Thread John Fouhy
You've got upper and lower bounds - maybe you could do a binary search to find the max exactly? It should only take the same number of steps again... On 9/25/07, Terry Carroll <[EMAIL PROTECTED]> wrote: > On Mon, 24 Sep 2007, Christopher Spears wrote: > > > How can I find the largest float and com

Re: [Tutor] largest and smallest numbers

2007-09-24 Thread Kent Johnson
Christopher Spears wrote: > How can I find the largest float and complex numbers? I don't know how to do this in standard Python. Here are some answers that use Numeric and numpy: http://groups.google.com/group/comp.lang.python/msg/fa7a761411ced62b http://www.thescripts.com/forum/post2028282-8.h

Re: [Tutor] largest and smallest numbers

2007-09-24 Thread Terry Carroll
On Mon, 24 Sep 2007, Christopher Spears wrote: > How can I find the largest float and complex numbers? That's an interesting question.. I just tried this: x = 2.0 while True: x = x*2 print x if repr(x) == "1.#INF": break to just keep doubling X until Python began representing it as

[Tutor] largest and smallest numbers

2007-09-24 Thread Christopher Spears
One of the exercises from Core Python Programmng (2nd Edition) asks me to determine the largest and smallest integers, float, and complex numbers my system can handle. Using python.org and Google, I have discovered my system's largest and smallest ingtegers: >>> import sys >>> sys.maxint 21474836