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 fetchin...@googlemail.com 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

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 pengyu...@gmail.com wrote: The problem is how to know what type of the argument and call the corresponding function. type(1) type 'int' type(1.2) type 'float' -- http://mail.python.org/mailman/listinfo/python-list

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

2009-09-20 Thread Grant Edwards
On 2009-09-20, Peng Yu pengyu...@gmail.com 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

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 inva...@invalid.invalid wrote: On 2009-09-20, Peng Yu pengyu...@gmail.com 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

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

2009-09-20 Thread Grant Edwards
On 2009-09-20, Peng Yu pengyu...@gmail.com 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?

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 inva...@invalid.invalid wrote: On 2009-09-20, Peng Yu pengyu...@gmail.com 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

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 pengyu...@gmail.com wrote: On Sun, Sep 20, 2009 at 9:37 AM, Grant Edwards inva...@invalid.invalid wrote: On 2009-09-20, Peng Yu pengyu...@gmail.com wrote: Suppose I want to define a function that return the minimum number that can be represented. def f(x):

How to get the minimum number that can be represented?

2009-09-19 Thread Peng Yu
Hi, 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 represented in the

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 represented in