Rounding up to the next 100

noydb jenn.duerr at gmail.com
Thu Jan 21 16:52:36 EST 2010


On Jan 21, 4:30 pm, Michael.Coll-Ba... at VerizonWireless.com wrote:
> > From: noydb
> > If one has a floating number as a string, is there a spiffy way to
> > round that string-number UP to the nearest 100?
>
> > XstrNmbr = 3579.127893 -- would want to round that to 3600.
>
> What's wrong with round?  round( XstrNmbr, -2 ) seems to do the trick.
> Or do you want to get rid of the decimal point as well?
>
> The information contained in this message and any attachment may be
> proprietary, confidential, and privileged or subject to the work
> product doctrine and thus protected from disclosure.  If the reader
> of this message is not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended
> recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited.
> If you have received this communication in error, please notify me
> immediately by replying to this message and deleting it and all
> copies and backups thereof.  Thank you.

Thanks Arnaud!

Michael - Nothing is wrong with round -- when I tried it initially, I
was confused on the base -- seeing it from this example helped clear
it up.



More information about the Python-list mailing list