[Previous]
[Contents]
[Next]

labs()

calculate the absolute value of a long integer

Synopsis:

#include <stdlib.h>
long int labs( long int j );

Description:

The labs() function returns the absolute value of its long-integer argument j.

Returns:

The absolute value.

Examples:

#include <stdio.h>
#include <stdlib.h>

void main()
  {
    long x, y;

    x = -50000L;
    y = labs( x );
    printf( "labs(%ld) = %ld\n", x, y );
  }

produces the output:

labs(-50000) = 50000

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

abs(), fabs()


[Previous]
[Contents]
[Next]