提交 29adaeb2 编写于 作者: A Alexander Monakov 提交者: Rich Felker

math: move i386 sqrtf to C with inline asm

上级 41b290ba
#include <math.h>
float sqrtf(float x)
{
long double t;
/* The long double result has sufficient precision so that
* second rounding to float still keeps the returned value
* correctly rounded, see Pierre Roux, "Innocuous Double
* Rounding of Basic Arithmetic Operations". */
__asm__ ("fsqrt" : "=t"(t) : "0"(x));
return (float)t;
}
.global sqrtf
.type sqrtf,@function
sqrtf: flds 4(%esp)
fsqrt
fstps 4(%esp)
flds 4(%esp)
ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册