What do I need to INCLUDE in order to do things like Log(), Sqrt() and trig functions like Sin(), Tan() etc......
Printable View
What do I need to INCLUDE in order to do things like Log(), Sqrt() and trig functions like Sin(), Tan() etc......
Hmmmm I think I know what you mean ....:)
To include math functions you'll need a maths library. (But I don't think this is appropriate.)
You should go and read about FPU (Floating Point Unit) in your assembly book (I believe you got one right?) or read this pretty good tutorial By Raymond Filiatreault
http://www.website.masmforum.com/tutorials/fptute/
Its kinda confusing at first but it assembly is until it finally clicks. Trust me it won't take for ever to figure it out....though i thought so 6 months ago. :)
Another way of doing this would be to use SSE, SSE2 or 3DNow!(But only works on AMDs). Unfortunately this is almost completely different from the FPU. These instructions allow you to do 4 multiplies/divides etc. in a single instruction(taking the time of 1 multiply/division etc. of the FPU).
SSE, SSE2 is harder to learn for one major reason.....there are no tutorials.
You have to read the intel manual :P.
However learning MMX (MMX works only on integers) will give you some basic idea about SIMD. Fortunately I have found 1 tutorial :) other than the intel manuals. Rawhed's MMX tutorial (Appeared in Hugi 19)
So the choice is yours....you'll have to look for a math's library / use FPU / use SSE/SSE2(SSE for single floating point while SSE2 for double)
Cheers,
Raedwulf
Actually, my book doesn't cover the FPU in detail with regard to performing things like trig or sqrt. It concentrates on virtually everything else though :D
Thanks for that link, it looks useful.
Cheers. :thumb:
No problem... if you get stuck i can help you out... :) It should just take practice though.
download the reference of your cpu (from intel's site for example). it's all there