Re: max / min / smallest float value on Python 2.5

2010-02-07 Thread Mark Dickinson
On Feb 7, 8:45 pm, duncan smith wrote: [...] > interested, but the following pseudo-python gives the idea.  For an [...] >              try: >                  yield rand() < exp(dF / temp) Practically speaking, the condition rand() < exp(dF / temp) is never going to be satisfied if dF / temp <

Re: max / min / smallest float value on Python 2.5

2010-02-07 Thread duncan smith
Steven D'Aprano wrote: On Sun, 07 Feb 2010 03:02:05 +, duncan smith wrote: The precise issue is that I'm supplying a default value of 2.2250738585072014e-308 for a parameter (finishing temperature for a simulated annealing algorithm) in an application. I develop on Ubuntu64, but (I am told

Re: max / min / smallest float value on Python 2.5

2010-02-07 Thread Steve Holden
duncan smith wrote: > Christian Heimes wrote: >> duncan smith wrote: >>> Hello, >>>I'm trying to find a clean and reliable way of uncovering >>> information about 'extremal' values for floats on versions of Python >>> earlier than 2.6 (just 2.5 actually). I don't want to add a >>> dependen

Re: max / min / smallest float value on Python 2.5

2010-02-07 Thread Mark Dickinson
On Feb 7, 12:52 am, duncan smith wrote: > import platform > if platform.architecture()[0].startswith('64'): >      TINY = 2.2250738585072014e-308 > else: >      TINY = 1.1754943508222875e-38 As Christian said, whether you're using 32-bit or 64-bit shouldn't make a difference here. Just use the f

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Steven D'Aprano
On Sun, 07 Feb 2010 03:02:05 +, duncan smith wrote: > The precise issue is that I'm supplying a default value of > 2.2250738585072014e-308 for a parameter (finishing temperature for a > simulated annealing algorithm) in an application. I develop on > Ubuntu64, but (I am told) it's too small a

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread duncan smith
Christian Heimes wrote: duncan smith wrote: Hello, I'm trying to find a clean and reliable way of uncovering information about 'extremal' values for floats on versions of Python earlier than 2.6 (just 2.5 actually). I don't want to add a dependence on 3rd party modules just for this p

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Steven D'Aprano
On Sun, 07 Feb 2010 00:52:48 +, duncan smith wrote: > Hello, >I'm trying to find a clean and reliable way of uncovering > information about 'extremal' values for floats on versions of Python > earlier than 2.6 (just 2.5 actually). I don't want to add a dependence > on 3rd party module

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Christian Heimes
duncan smith wrote: > Hello, >I'm trying to find a clean and reliable way of uncovering > information about 'extremal' values for floats on versions of Python > earlier than 2.6 (just 2.5 actually). I don't want to add a dependence > on 3rd party modules just for this purpose. e.g. For

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Benjamin Kaplan
On Sat, Feb 6, 2010 at 7:52 PM, duncan smith wrote: > Hello, >      I'm trying to find a clean and reliable way of uncovering information > about 'extremal' values for floats on versions of Python earlier than 2.6 > (just 2.5 actually).  I don't want to add a dependence on 3rd party modules > just

Re: max / min / smallest float value on Python 2.5

2010-02-06 Thread Shashwat Anand
On Sun, Feb 7, 2010 at 6:22 AM, duncan smith wrote: > Hello, > I'm trying to find a clean and reliable way of uncovering information > about 'extremal' values for floats on versions of Python earlier than 2.6 > (just 2.5 actually). I don't want to add a dependence on 3rd party modules > just

max / min / smallest float value on Python 2.5

2010-02-06 Thread duncan smith
Hello, I'm trying to find a clean and reliable way of uncovering information about 'extremal' values for floats on versions of Python earlier than 2.6 (just 2.5 actually). I don't want to add a dependence on 3rd party modules just for this purpose. e.g. For the smallest positive float