Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 8
Calculate the absolute value of a long integer
#include <stdlib.h>
long labs( long j );
- j
- The number you want the absolute value of.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The labs() function returns the absolute value
of its long-integer argument j.
The absolute value of j.
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
long x, y;
x = -50000;
y = labs( x );
printf( "labs( %d ) = %d\n", x, y );
return EXIT_SUCCESS;
}
produces the output:
labs( -50000 ) = 50000
ANSI,
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
abs(),
cabs(),
fabs()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 133
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/l/labs.html on line 133