# Formula to always return a desired number

• April 17th 2012, 05:36 PM
NavaraOz
Formula to always return a desired number
Hi all

I did read the notice about posting in the correct forum though I'm still not sure im in the right place so I do apologise if I am.

I run CNC machines and also program them.

What I'm trying to find is a formula that will always return a desired number with one variable put into the equation.

For example
1)The number I would like to return is 7
x=800
(x + formula)=7
Where x can be changed to any value I desire

And can this formula be easily adapted so that I may change my return number?

2)The number I would now like to return is 45
x=1250
(x + same formula with small alteration)=45

I hope that my explanation is clear enough as to what I'm trying to acheive.

In addition can the formula also be incremental?
In the first example, if x was increased by 32 the return number would be increased by 1 to return 8?
So if x=864 the return would be 9?
And if x=895 the return would stay at 9 as x hasnt increased by the full 32?

Thankyou so much for you help.
Matt
• April 18th 2012, 02:35 AM
a tutor
Re: Formula to always return a desired number
1) 7-x

2) 45-x

$\left \lfloor \frac{x-576}{32} \right \rfloor$

Is this what you want?

If you put in 864 you get (864-576)/32 = 9.

If you put in 895 you get (895-576)/32 = 9.9.... rounded down = 9

If you put in 896 you get 10.
• April 18th 2012, 02:02 PM
NavaraOz
Re: Formula to always return a desired number
Hey Tutor

Thats awesome!
Thankyou so much that worked a treat :)

Can you maybe answer a curious question of mine now, how is it that 576 is the magical number?
Seems so simple?