I think its pretty self explanatory from the code. Obviously I’m no evaluating the same thing over and over, its just example numbers to explain my problem. I’m guessing its over/underflow but I don’t know how to deal with it.
double d = (1 / (684985+157781));
System.out.println(d); // returns 0.0
System.out.println(Math.log(d)); // returns -Infinity.
(1 / (684985+157781))is an integer expression, so it will come out to0.The zero then gets assigned to the
double d, as0.0.Try changing the
1to1.0to force that expression to be a float, or1.0Dto force it to double.