这些东西被编译到工具链运行时,但由于GCC及其Windows端口MinGW(这是你的Dev-C++ IDE调用的)是开源的,你可以看看源代码.
这是最新的MinGW GCC; 这两个版本似乎基本上将所有工作推迟到处理器(这不是一个惊喜,因为x86 - 通过指令集的x87部分 - 本身支持平方根计算).
long double 值#include <math.h>
#include <errno.h>
extern long double __QNANL;
long double
sqrtl (long double x)
{
if (x < 0.0L )
{
errno = EDOM;
return __QNANL;
}
else
{
long double res;
asm ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
}
Run Code Online (Sandbox Code Playgroud)
float 值#include <math.h>
#include <errno.h>
extern float __QNANF;
float
sqrtf (float x)
{
if (x < 0.0F )
{
errno = EDOM;
return __QNANF;
}
else
{
float res;
asm ("fsqrt" : "=t" (res) : "0" (x));
return res;
}
}
Run Code Online (Sandbox Code Playgroud)