Floor value in math operators
avinashrude at gmail.com
Thu Apr 9 19:14:52 CEST 2009
On Apr 9, 8:26 am, David Smith <d... at cornell.edu> wrote:
> AggieDan04 wrote:
> > On Apr 8, 12:08 pm, David Smith <d... at cornell.edu> wrote:
> >> Avi wrote:
> >>> Hi,
> >>> This will be a very simple question to ask all the awesome programmers
> >>> here:
> >>> How can I get answer in in decimals for such a math operator:
> >>> 3/2
> >>> I get 1. I want to get 1.5
> >>> Thanks in advance,
> >>> Avi
> >> I'm going to assume your operands are variables instead of numeric
> >> literals. Why not consider doing a type conversion to float or Decimal
> >> and then perform the division?
> > Because float(x) and Decimal(x) fail for complex numbers and lose
> > precision if x is a rational or a multi-precision float.
> The OP didn't ask for anything complicated or high precision -- just
> wanted to divide two integer values and get a float/Decimal output.
Wow! I am overwhelmed by how much support I have at my finger tips. I
was hesitant to ask such a silly question and was worrying of being
Clearly, I have gained a lot by reading everyone's responses.
More information about the Python-list