MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » October 2004

RE: Round to the tenth



fixed

Hi,

> c  Eval(h)  temp = YourNumber / 10
> c  Eval     YourNewNumber = temp * 10

The original poster wanted to "always round up".  His example was that 101
should round up to 110.  But your code does not do that.  (It would have
to be 105 to round up to 110).

Instead, he probably wants to do something like this:

      eval temp = (YourNumber + 9) / 10
      eval yournewnumber = temp * 10

That way, 101 will round up to 110, but 100 won't.






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact