On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote:
> There's sys.float_info.min:
>
import sys
sys.float_info
> sys.float_info(max=1.7976931348623157e+308, max_exp=1024,
> max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021,
> min_10_exp=-307, dig=15, mant_dig=53, epsilon=2
On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote:
> On Sep 7, 3:47 pm, kj wrote:
>> Is there some standardized way (e.g. some "official" module of such
>> limit constants) to get the smallest positive float that Python will
>> regard as distinct from 0.0?
>>
>> TIA!
>>
>> kj
>
> There's
On Sep 7, 5:08 pm, kj wrote:
> Hmmm. This close-to-the-metal IEEE stuff make a "HERE BE DRAGONS!"
> alarms go off in my head... (What's up with that correction by 1
> to sys.float_info.mant_dig? Or, probably equivalently, why would
> sys.float_info.min_exp (-1021) be off by 1 relative to log2 o
In Mark
Dickinson writes:
>The smallest positive subnormal value
>is usually 2**-1074. If you want something that would still work
>if Python ever switched to using IEEE 754 binary128 format (or some
>other IEEE 754 format), then
>sys.float_info.min * 2**(1-sys.float_info.mant_dig)
Hmmm. Th
In Mark
Dickinson writes:
>On Sep 7, 3:47=A0pm, kj wrote:
>> Is there some standardized way (e.g. some "official" module of such
>> limit constants) to get the smallest positive float that Python
>> will regard as distinct from 0.0?
>>
>> TIA!
>>
>> kj
>There's sys.float_info.min:
impor
This topic came up before. =] See below. Not sure how 'standardised' this
is, though.
Double precision:
>>> import struct
>>> struct.unpack('d', struct.pack('Q', 1))[0]
4.9406564584124654e-324
Float precision:
>>> struct.unpack('f', struct.pack('L', 1))[0]
1.4012984643248171e-45
Cheers,
Xavier
On Sep 7, 3:47 pm, kj wrote:
> Is there some standardized way (e.g. some "official" module of such
> limit constants) to get the smallest positive float that Python
> will regard as distinct from 0.0?
>
> TIA!
>
> kj
There's sys.float_info.min:
>>> import sys
>>> sys.float_info
sys.float_info(ma
Paul McGuire wrote:
> On Sep 7, 9:47 am, kj wrote:
>> Is there some standardized way (e.g. some "official" module of such
>> limit constants) to get the smallest positive float that Python
>> will regard as distinct from 0.0?
>>
>> TIA!
>>
>> kj
>
> You could find it for yourself:
>
for i
On Sep 7, 9:47 am, kj wrote:
> Is there some standardized way (e.g. some "official" module of such
> limit constants) to get the smallest positive float that Python
> will regard as distinct from 0.0?
>
> TIA!
>
> kj
You could find it for yourself:
>>> for i in range(400):
...if 10**-i == 0:
Is there some standardized way (e.g. some "official" module of such
limit constants) to get the smallest positive float that Python
will regard as distinct from 0.0?
TIA!
kj
--
http://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo