sqrt() function not working with variable arguments [duplicate]

You need to link with the math library (use a ‘-lm’ on the command line). In the constant case, the compiler is probably being smart and precomputing sqrt(2.0) (so the code that is compiled is essentially ‘b = 1.414…;’)

Leave a Comment