static double truncateToPowerOfTwo(double d) { DoubleBits db = new DoubleBits.fromDouble(d); db.zeroLowerBits(52); return db.getDouble(); }