This topic is now archived and is closed to further replies.


This topic is 5932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
It is slow if you use it like ten thousand times in a loop, but still much faster than you can calculate it with a pencil and paper

Share this post

Link to post
Share on other sites
should translate into this in assembly language. is it fast. this is always a relative question. floating point calculations are always more intensive then integer calculations.

** [func] - _sqrtf.
** [desc] - calculates the square root of "eax" 32-bit float.
** [entr] - ss:[esp]: 32-bit floating point value.
** [exit] - eax: resulting square root.
; store the base pointer.
push ebp
mov ebp, esp
; retrieve the 32-bit float value from the stack.
fld dword ptr ss:[ebp + 4]
; store the square root 32-bit float value to the stack.
fstp dword ptr ss:[ebp + 4]
mov eax, dword ptr ss:[ebp + 4]
; restore the base pointer.
pop eax

Share this post

Link to post
Share on other sites