[lug] math.h Weirdness

Bill Thoen bthoen at gisnet.com
Mon Mar 12 20:14:52 MDT 2007


Am I mistaken in thinking that in C the sqrt() function is prototyped in
math.h? I just tried to build a simple C program that called sqrt() and the
linker balked. I then tried:

$ grep sqrt /usr/include/math.h
define M_2_SQRTPI     1.12837916709551257390  /* 2/sqrt(pi) */
define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
define M_2_SQRTPIl    1.1283791670955125738961589031215452L  /* 2/sqrt(pi) */
define M_SQRT2l       1.4142135623730950488016887242096981L  /* sqrt(2) */
define M_SQRT1_2l     0.7071067811865475244008443621048490L  /* 1/sqrt(2) */

It's not there! Shouldn't it be? If not, where is it these days, or has the
square root been retired?



More information about the LUG mailing list