I am working with a cos value which is represented in double. So my bounds are between -1.0 and 1.0, however for my work I am simply ignoring all negative variables.

Now I'd like to get the decimal number of this double number (sorry I couldn't find the literature term of this operation)

Basically with examples:

Assume that input is 0.12 then this could be written as 1.2 \* 10^-1, what I am expecting to get is just the part where it is 10^-1

Another example is 0.00351, which can be written as 3.51 \* 10^-3, so the expected result is 10^-3

I have developed this algorithm below but it's kind of quick and dirty. I was wondering whether is there any mathematical trick to avoid using a loop.

```
double result = 1;
while (input < 1.0) {
   input *= 10.0;
   result /= 10.0;
}

```

Also the above doesn't handle if input is 0.

I am using Java for coding if that helps.