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 of its argument

See also:

abs(), fabs()

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

Systems:

All (except DOS/PM)