template<class Integer>
double sqrt(Integer num); // constexpr since C++26
~ C++23
float sqrt(float num);
double sqrt(double num);
long double sqrt(long double num);
C++23 ~
/*floating-point-type*/ sqrt(/*floating-point-type*/ num); // constexpr since C++26
: square root(제곱근)을 반환합니다.
float sqrtf(float num);
: float 타입에 대해 형 변환없이 square root(제곱근)을 반환합니다.
long double sqrtl(long double num);
: long double 타입에 대해 형 변환없이 square root(제곱근)을 반환합니다.
<example>
#include <iostream>
#include <cmath>
using namespace std;
int main() {
cout << sqrtf(16) << endl;
cout << sqrtf(15.3);
return 0;
}
결과값
