Question: I need to write a small Java program that deals with calculations involving money. Therefore it needs to have accuracy. (Eg: No `float`/`double` variables, only `long`).

Unfortunately, the original value I need to use is imported through a method which can only read variables as "double".

Now, I tried casting it to a `long` using a method similar to:

```
double importedValue = x;
double importedValueConverted = (long) x;

```

However, when I try dividing importedValueConverted by another "long" variable I get:

> 
> required: long 
>  found: double 
>  error: possible loss of precision
> 
> 
> 

Why is that?

Answer: 
```
double importedValue = x;
double importedValueConverted = (long) x;

```

Note that both of these variables are declared as 'double'. This results in your error (paraphrasing): (the operation you're doing requires a) `long` (but when it tried it found a) `double`.

You want:

```
double importedValue = x;
long importedValueConverted = (long) x;

```
Why not look at [BigDecimal](http://docs.oracle.com/javase/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal%28double%29). It works well when I have used it. Be careful using the Double ctor though as Double is not that precise (eg it cannot accurately store 0.1). It may be more useful to use the [String](http://docs.oracle.com/javase/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal%28java.lang.String%29) ctor for BigDecimal