[BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
Dear All, I need one help. In python, I need to set the floating point precision as 2. I am getting the following output in python while adding two float nos. a=79.73 b=0.5 a+b 80.234 I need exactly 2 precision point in this float value. i.e. 80.23 Even though I tried in round

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Pradip Caulagi
On Tue, Aug 24, 2010 at 4:05 PM, Arulalan T arulal...@gmail.com wrote: In python, I need to set the floating point precision as 2. I am getting the following output in python while adding two float nos. a=79.73 b=0.5 Multiply by 100. Add as integers. Divide by 100.

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread vijay
Hi Arun,    Check out this a=79.73 b=0.5 c = '%.2f' %(a+b) c '80.23' Hope this help. With Regards Vijay --- On Tue, 24/8/10, Arulalan T arulal...@gmail.com wrote: From: Arulalan T arulal...@gmail.com Subject: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python To:

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
Hi, 2010/8/24 vijay vnbang2...@yahoo.com Hi Arun, Check out this a=79.73 b=0.5 c = '%.2f' %(a+b) c '80.23' It is string. float(c) 80.234 Again same problem getting . :( I need it as float only. Hope this help. With Regards Vijay --- On Tue, 24/8/10,

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
2010/8/24 Pradip Caulagi caul...@gmail.com On Tue, Aug 24, 2010 at 4:05 PM, Arulalan T arulal...@gmail.com wrote: In python, I need to set the floating point precision as 2. I am getting the following output in python while adding two float nos. a=79.73 b=0.5 Multiply by 100. Add

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Noufal Ibrahim
(I posted this to ChennaiPy but this list is wider so I'm reposting it). Arulalan T arulal...@gmail.com writes: Dear All, I need one help. In python, I need to set the floating point precision as 2. I am getting the following output in python while adding two float nos. Often, you

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
2010/8/24 Noufal Ibrahim nou...@gmail.com (I posted this to ChennaiPy but this list is wider so I'm reposting it). Arulalan T arulal...@gmail.com writes: Dear All, I need one help. In python, I need to set the floating point precision as 2. I am getting the following output in

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Noufal Ibrahim
Arulalan T arulal...@gmail.com writes: [...] Often, you *need* to only display the result of your calculations with n decimal places. Is yours such a situation? If so, forget the number of decimal points during the computation and when printing format it as appropriate (%.2f). I am not

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
2010/8/24 Noufal Ibrahim nou...@gmail.com Arulalan T arulal...@gmail.com writes: [...] Often, you *need* to only display the result of your calculations with n decimal places. Is yours such a situation? If so, forget the number of decimal points during the computation and when printing

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Roshan Mathews
On Tue, Aug 24, 2010 at 17:52, Arulalan T arulal...@gmail.com wrote: This gives the what I need. But I can not use this Decimal data type. In CDAT vcs module supports only the 'float data' type to represent the latitude logitude in map. so I need float value in 2 precision without changing

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
2010/8/24 Roshan Mathews rmath...@gmail.com On Tue, Aug 24, 2010 at 17:52, Arulalan T arulal...@gmail.com wrote: This gives the what I need. But I can not use this Decimal data type. In CDAT vcs module supports only the 'float data' type to represent the latitude logitude in map.

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Noufal Ibrahim
Arulalan T arulal...@gmail.com writes: [...] This gives the what I need. But I can not use this Decimal data type. In CDAT vcs module supports only the 'float data' type to represent the latitude logitude in map. so I need float value in 2 precision without changing the value. Not in

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Noufal Ibrahim
Arulalan T arulal...@gmail.com writes: [...] In CDAT[1] vcs module supports only the 'float data' type to represent the latitude logitude in World map. So I cant use Decimal or a string an integer. Only float. [...] I think that's a bug. The module should rely on duck typing rather than

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Arulalan T
2010/8/24 Noufal Ibrahim nou...@gmail.com: Arulalan T arulal...@gmail.com writes: [...] In CDAT[1] vcs module supports only the 'float data' type to represent the latitude logitude in World map.  So I cant use Decimal or a string an integer. Only float. [...] I think that's a bug.

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread renuka prasad
On Tue, Aug 24, 2010 at 7:29 PM, Arulalan T arulal...@gmail.com wrote: 2010/8/24 Noufal Ibrahim nou...@gmail.com: Arulalan T arulal...@gmail.com writes: [...] In CDAT[1] vcs module supports only the 'float data' type to represent the latitude logitude in World map. So I cant use

Re: [BangPypers] Need Help : Setting Floating Precision Point as 2 in Python

2010-08-24 Thread Noufal Ibrahim
renuka prasad renukapras...@gmail.com writes: [...] what is the reason for the previous problem? can you elaborate a bit.. What my understanding is that the typical code and value , that is what we code is not the same as its value but would like to know more.. can you explain a bit?

Re: [BangPypers] Clojure style multimethod functions in python

2010-08-24 Thread Baishampayan Ghose
Without making any change whatsoever to multi() and multi_method(), the result of the following code : # Declare the existence of a multi method switcher encounter = multi(lambda x,y : (x[Species], y[Species])) @multi_method(encounter, (Bunny,Lion)) def encounter(a1, a2):    return