0
$\begingroup$

Let say, I have a multiple 8. I have a initial value 48.7936628598344. Now, I need to make sure that 62 come in the series when I add multiple 8 with it's initial value.

Currently, 62 is not coming in the series.

48.7936628598344 + 1 * 8 = 56.79366286,

48.7936628598344 + 2 * 8 = 64.79366286,

48.7936628598344 + 3 * 8 = 72.79366286

What should I do the initial value 48.7936628598344

  • 0
    @Neal, see above comment.2012-04-14

1 Answers 1

1

Let's suppose that you search $n$ such that $62-8n$ is nearest of your input value $x$ then : $n=\operatorname{round}\left(\dfrac{62-x}8\right)$ so that the wanted integer could be : $N=62-8\cdot\operatorname{round}\left(\dfrac{62-x}8\right)$ If you want an integer larger than your input $x$ then use rather : $N=62-8\cdot\operatorname{floor}\left(\dfrac{62-x}8\right)$ (I'm supposing that you use a language 'C-like' where $\operatorname{floor}(x)$ returns an integer smaller than $x$)

Hoping this helped,

  • 0
    Yup. This is correct. Thanks2012-04-14