okay. how would i un sin and un tan somting, if i somting , if TAN(2) is 0.034920769491747730500402625773725, how would i get 2 back, same with sin, is this possable?
Posted on 2002-12-16 22:28:28 by Qages
On a calculator you would just use Tan ^-1(2)

In the old days they used tables because most values whether calculating sin, cos, tan or their inverse requires infinite calculations.

Lets face it. the square root of 2 is an irrational number.

There is no easy solution.
You are asking a question that requires some one to post an algo created for that purpose and its accuracy will be degraded by the limits of the FPU. It can handle only a subset of the real number system.

Perhaps someone has such an algo but i don't. Not a great programmer by any means.

However i don't know if the instruction set has functions that can easily do this.

Qbasic did.

Posted on 2002-12-16 22:56:57 by IwasTitan
hi all,
Here is a file the has many useful math functions,
But about how to get the arctan for a tangent value of an angle the FPU has an instruction that can do that

fpatan x ;

can calculate the arctangent of any tangent value to get the
use the trignometric relations.

my attachment would help.
Posted on 2002-12-17 00:08:11 by amr
fpatan is your friend.

As IwasTitan explained, you want to find the inverse map value. But, the value from the inverse map will be limited. What I mean is, if you have


for |x| > pi/2, you will never be able to recover the exact x by x = arctan(y). (Naturally!)

arcsin does not exist in the FPU instruction list, but you can get it easily with your trigonometric knowledge. That is,

arcsin(x) = arctan(x/sqrt(1-x*x))

Only thing left is just to list FPU instructions to compute the right hand side. :)

arrrrrgh... I was too slow. amr replied just before I submit my reply...
Posted on 2002-12-17 00:09:49 by Starless
fAsin Macro ;ArcSin(st)

fld st
fmul st,st
fsubr PlusOne

fAcos MACRO ;ArcCos(st)
fld st
fmul st,st
fsubr PlusOne

fAtan MACRO ;ArcTan(st)

Blowing my own trumpt here, but for more look to http://www.asmcommunity.net/board/index.php?topic=3536
Posted on 2002-12-17 11:29:17 by Eóin
The above replies are all generally correct. However, nobody has clarified that the FPU only accepts/returns angles expressed in radians for the trigonometry instructions.

Your tan(2)=.03492.... is correct when the "2" is in degrees. If you feed the .03492... to the FPU and use the fpatan instruction, you then have to convert the result from radians to degrees (multiply by pi/180) to get the original "2" back. It works.

Posted on 2002-12-17 19:25:28 by Raymond