Re: The smallest and largest values of numeric types



Lou Pecora wrote:
In article <QA4Vh.122$Bz6.77@xxxxxxxxxxxxx>, tom@xxxxxxxxxxx wrote:

Hi!
How can I determine the smallest and largest values of numeric types
(for example int) possible in my system? I think there exists a function
for this task but I don't know it.

There is or was a module called "kinds" which was an implementation of
PEP 0242. I have it and it gives the values you are looking for (and
more). But I don't know where I got it. I think it was once
distributed with Macpython on MacPython.org, but I'm not sure. I've
searched for it, but nothing shows up except my own questions about it
from many years ago and they have no clues.

I'm surprised they also didn't turn up my replies to those questions.

Does anyone know where this package is? Or what might replace it. It
is very useful.

It used to be distributed with Numeric.

http://numpy.cvs.sourceforge.net/numpy/kinds/

numpy exposes the same information for floating point types with its finfo
class. Nothing particular for ints.

--
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."
-- Umberto Eco

.



Relevant Pages

  • Re: Interesting list Validity (True/False)
    ... different string types, never compare equal; ... Why should the int 1 return True when compared to mpz? ... of shoes is not the same as a box of shoes, even if they are the same ... numeric types, so the earlier rule applies: ...
    (comp.lang.python)
  • Re: Struct a lightweight class type having value based semantics?
    ... Computer scientists have worked on defining type ... (i'm still a bit confused about about native types like int etc.. ... users of the language cannot define new numeric types. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Integer sizes
    ... I work with a C compiler for which, by default, int is 8 bits. ... and all this incomprehensible crap. ... where they define numeric types more inteligently, ... typing (keyboard typing I mean), and to play along with existing code. ...
    (comp.lang.cpp)
  • Re: The smallest and largest values of numeric types
    ... of numeric types (for example int) possible in my ... For floats, ... # Determine max binary digits for float on this system. ...
    (comp.lang.python)
  • Re: NumPy Question - numpy.put in multi-dimensional array
    ... a = zeros, int) ... 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 ...
    (comp.lang.python)