Skip to main content

abs

Discworld driver help

abs

Name

abs() - Return the absolute value of a number.

Synopsis

int abs( int i )
float abs( float f )

Description

abs() returns the absolute value of an int or a float, the returned type matching the input type.

Example

abs( 4 ) == 4
abs( -5 ) == 5
abs( 0.3505 ) == 0.3505
abs( -23.43 ) == 23.43
abs( 0 ) == 0