A friendly place for programming greenhorns!
Big Moose Saloon
Search

Java FAQ

Recent Topics

Flagged Topics

Hot Topics

Zero Replies
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0808
this week in the
OCAJP
forum!
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
extremes of Math.ceil
Marlene Miller
Ranch Hand
Joined: Mar 05, 2003
Posts: 1391
posted
May 16, 2003 12:48:00
0
An inquiry into the extremes of Math.ceil
class Test { public static void main(String[] args) { // System.out.println(Math.ceil(10)); System.out.println(Math.ceil(10)); System.out.println(Math.ceil(0)); System.out.println(Math.ceil('c')); //'c' == 99 System.out.println(Math.ceil(0xc)); // System.out.println(Math.ceil(0.1f)); System.out.println(Math.ceil(0.9f)); // System.out.println(Math.ceil(Float.NaN)); System.out.println(Math.ceil(Float.POSITIVE_INFINITY)); System.out.println(Math.ceil(Float.NEGATIVE_INFINITY)); System.out.println(Math.ceil(0.0f)); System.out.println(Math.ceil(0.0f)); // System.out.println(Math.ceil(Float.MIN_VALUE)); System.out.println(Math.floor(Float.MIN_VALUE)); System.out.println(Math.ceil(Float.MIN_VALUE)); System.out.println(Math.floor(Float.MIN_VALUE)); // System.out.println( Math.ceil(Float.MAX_VALUE) == Float.MAX_VALUE); System.out.println( Math.ceil(Float.MAX_VALUE) == Float.POSITIVE_INFINITY); // System.out.println( Math.ceil(Float.MAX_VALUE) == Integer.MIN_VALUE); System.out.println( Math.ceil(Float.MAX_VALUE) == Float.MAX_VALUE); // System.out.println(2 * Float.MAX_VALUE == Float.MAX_VALUE); System.out.println( 2 * Float.MAX_VALUE == Float.POSITIVE_INFINITY); // System.out.println(Float.MIN_VALUE / 2 == Float.MIN_VALUE); System.out.println(Float.MIN_VALUE / 2 == 0.0f); } }
[ May 16, 2003: Message edited by: Marlene Miller ]
Yi Meng
Ranch Hand
Joined: May 07, 2003
Posts: 270
posted
May 17, 2003 07:39:00
0
10.0
10.0
0.0
99.0
12.0
1.0
0.0
NaN
Infinity
Infinity
0.0
0.0
1.0
0.0
0.0
1.0
true
false
false
true
false
true
false
true
Meng Yi
Yi Meng
Ranch Hand
Joined: May 07, 2003
Posts: 270
posted
May 17, 2003 07:41:00
0
10.0
10.0
0.0
99.0
12.0
1.0
0.0
NaN
Infinity
Infinity
0.0
0.0
1.0
0.0
0.0
1.0
tr
Don't get me started about those stupid
light bulbs
.
subject: extremes of Math.ceil
Similar Threads
simple quiz on Math.ceil
"Top Ten Topics that Everyone Thinks are on the SCJP Exam, but Aren't " Bert Bates
What is NotaNumber (NaN)?
Float.MIN_VALUE and Float.MAX_VALUE behave differently. why
castin primitives problem
All times are in JavaRanch time: GMT6 in summer, GMT7 in winter