Re: rounding a number
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Mon, 27 Nov 2006 19:15:48 GMT
arman wrote:
Hi,You can fiddle around with the mod and modulus function. But, an
How do you round some arbitrary number to the 10 multiplier? I need to
make a graph. The y-axis is dependent on the result of the computation.
If the maximum value of the y-axis, say for example 278, then I want
the y-axis to have a maximum of 300, or if it 2435 then I want the
maximum of 2500. So, basically it has to convert an arbitrary number
into some integer number that can be divided by 10.
thanks in advance,
-arman-
easier way Is to just do an integer divide.
J = K/10*10 + 10
will do what you want/ The divide throws away the remainder, the
multiply brings you back to a multiple of 10 that is smaller than you
want and the + 10 rounds up.
If you want to be careful about rounding values that are a multiple of
10, you could experiment with
J = (K+9)/10*10
*** Hendrickson
.
- Follow-Ups:
- Re: rounding a number
- From: John Harper
- Re: rounding a number
- References:
- rounding a number
- From: arman
- rounding a number
- Prev by Date: Re: How to assign a=b=c=2 in fortran in one statement
- Next by Date: Re: rounding a number
- Previous by thread: rounding a number
- Next by thread: Re: rounding a number
- Index(es):