Re: is int(round(val)) safe?

From: Steven Bethard (steven.bethard_at_gmail.com)
Date: 11/22/04


Date: Mon, 22 Nov 2004 21:33:23 GMT

Peter Hansen wrote:
> Since round() returns an integer

Just to clarify in case anyone else misreads this, I belive the intent
here was to say that round(f) -- that is, round with only a single
argument -- returns a floating point number with no fractional component
after the decimal point. The result is still a float, not an int though:

>>> round(3.14159265359)
3.0
>>> round(3.14159265359, 2)
3.1400000000000001

I think the intent was clear from the rest of the post, but I figured it
wouldn't hurt to clarify this for any newbies who misread it like I did.

Steve



Relevant Pages

  • Re: is int(round(val)) safe?
    ... >> Since round() returns an integer ... > Just to clarify in case anyone else misreads this, ... > I think the intent was clear from the rest of the post, ... > wouldn't hurt to clarify this for any newbies who misread it like I did. ...
    (comp.lang.python)
  • Re: matlab fscanf
    ... way in the future -- it would be best to report only the exact ... it's possible the intent to clarify will ... simply obfuscate. ...
    (comp.soft-sys.matlab)
  • Re: Division Problem
    ... The intent, as I ... undestand it is to add the values in the 10 fields, ... >> Where n is the number of decimal places you want to round to. ... >> to play with it to find the correct property of event to put it in. ...
    (microsoft.public.access.forms)
  • Re: When Overloading the Plus Operator, What are Valid Arguments Types?
    ... enthusiastically to pin down the root cause. ... family to clarify the intent. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Binoculars?
    ... To clarify, one who 'religously' engages in using slightly mis-spoken ... Generally with the intent of producing an ... amused reaction. ...
    (rec.outdoors.rv-travel)

Loading