Category: Web Programming » Java Script » Methods · 1 comment
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns the absolute value of a number

Syntax:

Math.abs(number)

Parameters Description
number Required. Any numeric expression

Return Data Type:
Numeric

Usage / Example Code:

You can test it the following code using document.write() or alert() methods

Statement Result / Value Remark / Note
Math.abs(1) 1
Math.abs(123) 123
Math.abs(45.678) 45.678
Math.abs(-1) 1
Math.abs(-123) 123
Math.abs(-45.678) 45.678
Math.abs(0) 0
Math.abs(unknown) Error unknown is not defined (uninitialized variable)
Math.abs(initialized) NaN Not a Number
Math.abs(null) 0
Math.abs(‘string’) NaN Not a Number
Math.abs(’45.678′) 45.678
Math.abs(true) 1
Math.abs(false) 0
Math.abs() NaN Not a Number

Related Articles:

Print Friendly
Category: Web Programming » ASP » Functions · 2 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns the absolute value of a number

Syntax:

abs(number)

Parameters Description
number Required. A numeric expression

Return Data Type:
Variant (Double | Integer | Long). If number contains Null, Null is returned

Usage / Example Code:

Statement Result / Value Remark / Note
abs(1) 1
abs(234) 234
abs(56.78) 56.78
abs(-1) 1
abs(-234) 234
abs(-56.78) 56.78
abs(0) 0
abs(unknown) 0 Uninitialized variable
abs(null) Null value
abs(“string”) Error Runtime Error: Type mismatch: ‘[string: "string"]‘
abs(“56.78″) 56.78 Number as string
abs(true) 1 True – Non zero
abs(false) 0 False – Zero
abs() Error Runtime error 800a01c2: Wrong number of arguments or invalid property assignment: ‘abs’

Related Articles:

Print Friendly
Category: Web Programming » PHP » Functions · 3 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns the absolute value of input number

Syntax:

abs($number)

Parameters Description
$number Required. Numeric value to process

Return Data Type:
If the argument number is of type float, the return type is also float, otherwise it is integer

Usage / Example Code:

Statement Result / Value Remark / Note
abs(1) 1
abs(234) 234
abs(98.765) 98.765
abs(-1) 1
abs(-234) 234
abs(-98.765) 98.765
abs(0) 0
abs($unknown) 0 uninitialized variable
abs(null) 0
abs(‘string’) 0
abs(’98.765′) 98.765 number as string
abs(True) 1 True – Non zero
abs(False) 0 False – Zero
abs() Error Warning: abs() expects exactly 1 parameter, 0 given

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 3 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a value of the same type that is passed to it specifying the absolute value of a number

Syntax:

Abs(number)

Parameters Description
number Required. A numeric expression

Return Data Type:
Variant (Double | Integer | Long)

Usage / Example Code:

Statement Result / Value Remark / Note
Abs(1) 1
Abs(533) 533
Abs(34.57) 34.57
Abs(-1) 1
Abs(-533) 533
Abs(-34.57) 34.57
Abs(0) 0
Abs(unknown) 0 uninitialized variable
Abs(null) Null
Abs(“string”) Error Run-time error 13: type mismatch
Abs(“34.57″) 34.57
Abs(True) 1 True – non zero
Abs(False) 0 False – zero
Abs() Error Compile error: Expected: expression

Related Articles:

Print Friendly