What's the exact/closest approximate to the inverse of getting 70%?

48 Views Asked by At

To clarify: I'm creating a computer program and I'm trying to find the actual mathematical way of approaching my problem. Given a number x, a is 0.7x. After doing some testing, it seems that to get back up to x from a, I can multiply by 1.42857143, but sometimes this isn't enough precision and gets a number that is very wrong.

Is there a blatantly obvious solution to this that I can't see? I want to find a better way to solve this without repeatedly adding 1 until it's right.

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

Ooooookay so it looks like I'm an idiot. 1.42857143 is 10÷7, and somehow I didn't notice that. I can simply just repeat the value if I want more precision.

0
On

Precision of operations is limited on computers.

What data type do you use? Float? Double?

To get better precision, you may want to use the types like BigDecimal.

If this is not sufficient, use other tools for programming like Mathematica.