Re: is int(round(val)) safe?
From: Steven Bethard (steven.bethard_at_gmail.com)
Date: 11/22/04
- Next message: Peter Dobcsanyi: "ANN: pydesign 0.5"
- Previous message: Peter.....: "login script to database"
- In reply to: Peter Hansen: "Re: is int(round(val)) safe?"
- Next in thread: Peter Hansen: "Re: is int(round(val)) safe?"
- Reply: Peter Hansen: "Re: is int(round(val)) safe?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Peter Dobcsanyi: "ANN: pydesign 0.5"
- Previous message: Peter.....: "login script to database"
- In reply to: Peter Hansen: "Re: is int(round(val)) safe?"
- Next in thread: Peter Hansen: "Re: is int(round(val)) safe?"
- Reply: Peter Hansen: "Re: is int(round(val)) safe?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
Loading