Raymond Filiatreault, Simply FPU, Chapter 10 (http://www.ray.masmcode.com/tutorial/fpuchap10.htm):
QuoteFPU instructions are not available to directly compute the arcsine and the arccosine. The FPATAN instruction must be used for that purpose based on the usual trigonometric equivalents:
tan(x) = sin(x)/cos(x)
and sin2(x) + cos2(x) = 1
Typical code to compute arcsin[sin(x)] from the sine value in ST(0) would be as follows.
;ST(0)=sin(x), ST(1)=zzz
fld st ;ST(0)=sin(x), ST(1)=sin(x), ST(2)=zzz
fmul st,st ;ST(0)=sin2(x), ST(1)=sin(x), ST(2)=zzz
fld1 ;ST(0)=1.0, ST(1)=sin2(x), ST(2)=sin(x), ST(3)=zzz
fsubr ;ST(0)=1-sin2(x)=cos2(x), ST(1)=sin(x), ST(2)=zzz
fsqrt ;ST(0)=cos(x), ST(1)=sin(x), ST(2)=zzz
fpatan ;ST(0)=arcsin[sin(x)]=x (in radians), ST(1)=zzz
Sorry if this is a stupid question: What is the value ST(1)=zzz? I've tried to put 0.5 in ST(0), but that's not enough, fpatan needs two values.
Hi,
If I am reading the code correctly, FPATAN is
using ST(0) equal to cos(x), ST(1) is sin(x), and
zzz means unused.
Regards,
Steve N.
Thanks, Steve :thup:
ST(1)= (https://www.animated-smileys.com/emoticons/animated-smileys-sleeping-020.gif.pagespeed.ce.5vA9FHge8N.gif)
:biggrin:
Resolved (http://masm32.com/board/index.php?topic=9039.0;topicseen) :biggrin: