Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 8th, 2005, 2:41 PM   #1
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
[x86]How to use fsqrt

Where shall I put the value I want to apply the fsqrt instruction on?
int main()
{
	float x = 2.0f;

	_asm
	{
		mov eax, x
		fsqrt          ; Which register does this one use?
		mov x, eax  ; Where is the answear put? eax?
	}

	std::cout << x;
	return 0;
}

As you might guess I want the program to print 1.4142...
But how?

/Klarre
Klarre is online now   Reply With Quote
Old Nov 8th, 2005, 3:03 PM   #2
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
Solved it using this:

	_asm
	{
		fld x
		fsqrt
		fst x
	}
Klarre is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC