[Pythonmac-SIG] Numeric Q: How to get DBL_MAX, etc. in Python?
Michael Hudson
mwh@python.net
25 Jul 2002 16:03:24 +0100
"Louis M. Pecora" <pecora@anvil.nrl.navy.mil> writes:
> In C there are platform-specfic, floating-point constants as follows defined in float.h,
>
> /* The largest double precision # */
> DBL_MAX (* (double *) __double_max)
>
> /* The accuracy of double precision */
> #define DBL_EPSILON (* (double *) __double_epsilon)
>
> /* The smallest double precision # */
> #define DBL_MIN (* (double *) __double_min)
>
> Where do these reside in Python?
Nowhere.
> I have looked over my Python manuals and done a Google search, but
> can't find any reference to them or float/double limits outside of
> some threads online that are requesting the same as me, but no
> answers. Are there standard Python functions or globals that return
> these values for the platform one is operating on?
Nope. Obviously writing a C extension to expose these shouldn't be
too hard... (although making them constants is inevitably a bit broken
-- DBL_EPSILON varies as the rounding mode does, for example).
> Any help appreciated. Thanks.
Well, not sure this counts.
Cheers,
M.
--
> So what does "abc" / "ab" equal?
cheese
-- Steve Holden defends obscure semantics on comp.lang.python