I have referred to the following posts:
Why do you have to link the math library in C?
Why do I have to explicitly link with libm?
All of them suggest I need to link libm explicitly with my program. But I don't get the errors they are getting and my program seems to run fine. I ran ldd on my executable and it doesn't show libm being linked to the program. What's happening?My code:
#include<math.h>#include<stdio.h>void main(){ double a = fabs(-10); double b = floor(20.12f); double c = ceil(21.1); printf("%f,%f,%f",a,b,c);}