我想tan(pi)
用 X87 FPTAN 和 FDIVR 计算:
#include <stdio.h>
int main(){
double answer,angle=3.14;
__asm__ ("FPTAN;"
"FDIVR;"
: "=t" (answer) : "0" (angle));
printf ("angle = %g\n",angle);
printf ("answer = %g\n",answer);
}
但我得到一个编译错误
error: unknown use of instruction mnemonic without a size suffix
__asm__ ("FPTAN;"
^
<inline asm>:1:8: note: instantiated into assembly here
FPTAN;FDIVR;
^
1 error generated.
我怎样才能摆脱错误?似乎需要一个大小后缀,但我看不到如何构建指令。
有关信息,我的“gcc -v”返回
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix