*
A friendly place for programming greenhorns!
Big Moose Saloon
Search

Java FAQ

Recent Topics

Flagged Topics

Hot Topics

Zero Replies
Register / Login
JavaRanch
»
Java Forums
»
Certification
»
Programmer Certification (SCJP/OCPJP)
Author
Math.abs()
Jiji Cherian
Greenhorn
Joined: Apr 15, 2005
Posts: 14
posted
Jul 25, 2005 22:52:00
0
Hi there.
This is a question related to Math.abs().
Why Math.abs(Integer.MIN_VALUE)and Math.abs(Long.MIN_VALUE)returns ve value.
Looking forward for your valuable answers??
Thanks in advance..
Rgds.<br /> <a href="mailto:mr.jiji@gmail.com" rel="nofollow">mr.jiji@gmail.com</a>
Joyce Lee
Ranch Hand
Joined: Jul 11, 2003
Posts: 1392
posted
Jul 26, 2005 01:40:00
0
Hi Jiji,
The negation of Integer.MIN_VALUE (2147483648) will result in overflow since the range for
int
is 2147483648 to 2147483647. Same for
long
.
Joyce
I agree. Here's the link:
http://aspose.com/filetools
subject: Math.abs()
Similar Threads
help with this Q
Challenge: circular counter without conditional branches
Where am I wrong??
howto eliminate negative sign of number ?
Math.abs(Integer.MIN_VALUE)) not returning abs val
All times are in JavaRanch time: GMT6 in summer, GMT7 in winter