Re: How to get the minimum number that can be represented?

2009-09-20 Thread Simon Forman
On Sep 20, 11:23 am, Peng Yu wrote: > On Sun, Sep 20, 2009 at 9:37 AM, Grant Edwards > wrote: > > On 2009-09-20, Peng Yu wrote: > > >> Suppose I want to define a function that return the minimum number > >> that can be represented. > > >> def f(x): > >>   #body > > >> That it, if I call f(10),

Re: Re: How to get the minimum number that can be represented?

2009-09-20 Thread Dave Angel
Peng Yu wrote: On Sun, Sep 20, 2009 at 9:37 AM, Grant Edwards wrote: On 2009-09-20, Peng Yu wrote: Suppose I want to define a function that return the minimum number that can be represented. def f(x): #body That it, if I call f(10), f will return the minimum integer that can be r

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Grant Edwards
On 2009-09-20, Peng Yu wrote: >> You might also want to read up on the type() builtin > > I want avoid using any 'if' statement. Why? > In C++, I can use template. If you want to write C++ code, then you should use a C++ compiler. > How to do not use 'if' statement in python? In python you u

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Peng Yu
On Sun, Sep 20, 2009 at 9:37 AM, Grant Edwards wrote: > On 2009-09-20, Peng Yu wrote: > >> Suppose I want to define a function that return the minimum number >> that can be represented. >> >> def f(x): >>   #body >> >> That it, if I call f(10), f will return the minimum integer that can >> be rep

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Grant Edwards
On 2009-09-20, Peng Yu wrote: > Suppose I want to define a function that return the minimum number > that can be represented. > > def f(x): > #body > > That it, if I call f(10), f will return the minimum integer that can > be represented in the machine; if I cal f(10.5), f will return the > min

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Radu Grigore
On Sep 20, 1:15 pm, Peng Yu wrote: > The problem is how to know what type of the argument and call the > corresponding function. >>> type(1) >>> type(1.2) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get the minimum number that can be represented?

2009-09-20 Thread Peng Yu
On Sun, Sep 20, 2009 at 12:46 AM, Daniel Fetchinson wrote: >> Suppose I want to define a function that return the minimum number >> that can be represented. >> >> def f(x): >>   #body >> >> That it, if I call f(10), f will return the minimum integer that can >> be represented in the machine; if I

Re: How to get the minimum number that can be represented?

2009-09-19 Thread Daniel Fetchinson
> Suppose I want to define a function that return the minimum number > that can be represented. > > def f(x): > #body > > That it, if I call f(10), f will return the minimum integer that can > be represented in the machine; if I cal f(10.5), f will return the > minimum float that can be represent