I have two LongProperty (there are no decimal places in a long) variables (longProperty1 and longProperty2). I need to divide them and I need to keep the division result in a DoubleProperty (there are decimal places in a double) variable (result) without losing decimal places.
final DoubleProperty result = new SimpleDoubleProperty(0.0);
final LongProperty longProperty1 = new SimpleLongProperty(45);
final LongProperty longProperty2 = new SimpleLongProperty(7);
result.bind(longProperty1.divide(longProperty2));
System.out.println(result.get()); //print: "6.0" instead of "6.428571428571429" (lost decimal places)
longProperty1 and longProperty2 are of type LongProperty because they receive very large numbers, so I can't cast them to DoubleProperties.
On the other hand, the result will receive a value from 0.0 to 1.0 (for example: 0.0, 0.2975, 0.5378, 0.9853, 1.0), because in my real problem longProperty1 <= longProperty2(for example: 500/600=0.8333, 1/2=0.5, 1897/5975=0.3174, ...).
How to do this?