So here is what things will convert to: 0.5 = 2; 0.25 = 4; + MILLIONS MORE
1 = The whole of a number ( / 1 )
0.5 = Half of the number ( / 2)
But what is the math to convert decimals into only a hardcore integer?
So here is what things will convert to: 0.5 = 2; 0.25 = 4; + MILLIONS MORE
1 = The whole of a number ( / 1 )
0.5 = Half of the number ( / 2)
But what is the math to convert decimals into only a hardcore integer?
I think what you are looking for is the reciprocal or multiplicative inverse of the number, typically denoted $x^{-1}$ or $\frac{1}{x}$. Using your example of $0.5$, you have $0.5=\frac{1}{2}$. How do you get $2$ from this? Well, $(0.5)^{-1}=\left(\frac{1}{2}\right)^{-1}=\dfrac{1}{\frac{1}{2}}=2$. This will only produce an integer if the decimal you are using is the inverse of an integer.
I believe what you are looking for is the reciprocal.
$0.5 = \frac12$ and also in general $0.5 = \frac{x}{2x}$ for every real number $x$ aside from $0$.
The reciprocal is like "flipping the fraction". Indeed, the reciprocal of $\frac12$ is $\frac{2}{1}$. Likewise, the reciprocal of $\frac{x}{2x}$ is $\frac{2x}{x}$. In this latter example, $x\neq 0$, so the $x$ in the numerator and the denominator cancel: $\frac{2x}{x} = 2$.
A repeating or terminating decimal representation can always be turned into a fraction (because a terminating or repeating decimal number is rational). To see a general technique for doing so, see for example here. In that example, the number $0.234343434\ldots$ has a reciprocal of $\frac{495}{116}$.
One interesting property of reciprocals is that any (nonzero) number multiplied by its reciprocal will result in 1!. This is because in general $$\frac{a}{b} \cdot \frac{b}{a} = \frac{ab}{ab} = 1.$$
I found out my programmers helped! So 0.25 keep adding it:
0.25 - 0.50 -----0.75----1.00
1 ------- 2 ------- 3 ------ 4
So you had to times 0.25 > 4 times < before it made 1. So the answer is 4.
For example here it is for 0.5:
0.5 - 1
1 ---- 2
Had to times it twice so its 2.
That is how you do it! By keep timesing it intil it creates 1 and count how many times it took and divide the final number by that:
0.25 of 1000:
0.25 - 0.50 -----0.75----1.00
1 ------- 2 ------- 3 ------ 4
1000 / 4.
That is the algorithm. I feel stupid now.