Jacob Meuser wrote:

Why does the following:

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

int main()
{
long int a;

a = lrint(2.1314);

printf("a = %li\n", a);

exit(0);
}

when compiled with:

gcc -Wall -lm -o lrint lrint.c

always complain:

lrint.c: In function `main':
lrint.c:9: warning: implicit declaration of function `lrint'

?

Works fine though.

Also, what's the difference between lrint() and (long)rint()?  I mean,
why even have lrint?  Faster because it's integer only?



It works because it's acceptable. You get compiler warnings because your constant argument to lrint is not explicitly cast as type double. In a nutshell, C is strongly typed and gcc -Wall will point this out to you.

Looks like they generate a different set of errno returns under some circumstances and rint return type is double.

Steve

_______________________________________________
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug

Reply via email to