I need to extract the decimal part of a float number, but I get weird results:
float n = 22.65f; // I want x = 0.65f, but... x = n % 1; // x = 0.6499996 x
I bit long but works:
BigDecimal.valueOf(2.65d).divideAndRemainder(BigDecimal.ONE)[1].floatValue()