Calculate a square and a square root! You must make a polyglot that outputs the square of the input in one language and the square root of the input in another. The shortest answer in bytes wins!

You must have a precision of at least 3 decimal places, and the input will always be a positive float.
C and C++, 68 65 bytes

#include&lt;math.h&gt;
float f(float n){auto p=.5;return pow(n,2-p*3);}


Original answer:

#include&lt;math.h&gt;
float f(float n){return pow(n,sizeof('-')-1?2:.5);}


For both versions, C produces n^2 and C++ produces sqrt(n).