private boolean allItemsValid() { try { MicroFloat.parseFloat(get_reticulocytes().getString()); MicroFloat.parseFloat(get_hemotocrit().getString()); return true; } catch (Exception e) { return false; } }
/** Returns a true integer, not an integer containing a packed floating point number. */ public int getAccuracyPercentage() { // 0.9.6 - if no responses at all so far, the accuracy is deemed // to be 100%, not 0% (which the calculation below would give). if (m_iTotalResponseCount == 0) return 100; // fpii stands for "float packed into integer". int fpiiCorrect = MicroFloat.intToFloat(getCorrectResponseCount()); int fpiiTotal = MicroFloat.intToFloat(getTotalResponseCount()); int fpiiPackedFraction = MicroFloat.div(fpiiCorrect, fpiiTotal); int fpiiHundred = MicroFloat.intToFloat((int) 100); int fpiiPercentage = MicroFloat.mul(fpiiPackedFraction, fpiiHundred); int fpiiRounded = MicroFloat.rint(fpiiPercentage); return MicroFloat.intValue(fpiiRounded); }