Java/Development Class/ChoiceFormat
Версия от 18:01, 31 мая 2010; (обсуждение)
Get the smallest double greater than d
import java.text.ChoiceFormat;
public class Main {
public static void main(String[] argv) throws Exception {
double d = 1.2;
double d2 = ChoiceFormat.nextDouble(d);
System.out.println(d2);
}
}
//1.2000000000000002
Incrementing a Double by the Smallest Possible Amount
import java.text.ChoiceFormat;
public class Main {
public static void main(String[] argv) throws Exception {
double d = 1.2;
// Get the largest double less than d
double d1 = ChoiceFormat.previousDouble(d);
System.out.println(d1);
}
}
//1.1999999999999997