[Tutor] largest and smallest numbers

Kent Johnson kent37 at tds.net
Sun Oct 7 15:03:25 CEST 2007


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:
> 
>>>> import sys
>>>> sys.maxint
> 2147483647
>>>> -sys.maxint - 1
> -2147483648
> 
> How can I find the largest float and complex numbers?

There is an extensive discussion starting here:
http://homepages.cwi.nl/%7Esteven/enquire.html

It also points to float.h. On my computer that is at 
/usr/includes/float.h and includes among other things
#define __FLT_MIN__ 1.17549435e-38F
#define __FLT_MAX__ 3.40282347e+38F

Kent


More information about the Tutor mailing list