This function returns the absolute value of the argument.
The absolute value of a number is its distance from zero.
In general, the result has the same magnitude as the argument but always has a positive sign.
Special boundary conditions that affect the results are:
On some implementations, the absolute value of the most negative integer number may not be representable in the positive range.
This is not the same as Number.MIN_VALUE and Number.MAX_VALUE. They describe the largest and smallest possible positive floating point values.
It is possible that due to the underlying implementation of the math library, the absolute value of the most negative number my not be representable and it may yield NaN instead.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> for(myEnum = 1.5; myEnum > -2; myEnum -= 0.1) { document.write(myEnum + " " + Math.abs(myEnum) + "<BR>"); } </SCRIPT> </BODY> </HTML>
Prev | Home | Next |
Math object | Up | Math.acos() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |