title: How to set nice float value using Apache POI?
body: <p>I'm trying to set a cell value to a nice <code>float</code> value. I want to set cell value to <code>5.2</code>, but I get <code>5.1999998093</code> instead. What would be a solution for this?</p>
  
  <pre><code>Workbook workbook = new HSSFWorkbook();
  Sheet worksheet = workbook.createSheet();
  CellStyle style = workbook.createCellStyle();
  style.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.0"));
  
  int i = 0;
  worksheet.createRow(i + 1);
  worksheet.getRow(i + 1).createCell(0).setCellStyle(style);
  worksheet.getRow(i + 1).getCell(0).setCellValue(new BigDecimal("5.2").floatValue());
  </code></pre>