首页 > 学院 > 开发设计 > 正文

求二次根式(汇编浮点数指令fsqrt实现)

2019-11-06 09:01:29
字体:
来源:转载
供稿:网友
#include<iostream>#include<cmath>using namespace std;int main(){	double x = 2;	double r = 0;	float y=0;	int a = 0;	__asm{		fld x//传入的一定要是浮点数,否则结果错误.		fsqrt		fst r		fst y		mov a,eax	}	cout<< x << endl;	cout << r << endl;	cout << sqrtf(2) << endl;	cout << y << endl;	cout << a << endl;	return 0;}
21.414211.414211.414215505368
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表