The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.text  [26 examples]

e309. Incrementing a Double by the Smallest Possible Amount

    double d = 1.2;
    
    // Get the largest double less than d
    double d1 = ChoiceFormat.previousDouble(d); // 1.1999999999999997
    
    // Get the smallest double greater than d
    double d2 = ChoiceFormat.nextDouble(d);     // 1.2000000000000002

 Related Examples
e305. Determining the Type of a Character
e306. Comparing Strings in a Locale-Independent Way
e307. Iterating the Characters of a String
e308. Adding an Attribute to a String
e310. Localizing Messages

See also: Dates    Messsages    Numbers    Times    Words and Sentences   


© 2002 Addison-Wesley.