001package edu.pdx.cs410J.tips;
002
003/**
004 * This program demonstrates that <code>double</code>s only provide
005 * <I>approximations</I> of negative powers of 10.
006 *
007 * @see BigDecimalDemo
008 *
009 * @author David Whitlock
010 * @version $Revision: 1.1 $
011 */
012public class DoubleTrouble {
013
014  public static void main(String[] args) {
015    double increment = 0.10;  // Not REALLY 0.10
016    double total = 0.0;
017    for (int i = 0; i < 10; i++) {
018      System.out.println(total);
019      total += increment;
020    }
021    System.out.println(total + (total == 1.00 ? "\nYes" : "\nNo?"));
022  }
023
024}