The MASM Forum

General => The Campus => Topic started by: jj2007 on December 20, 2020, 09:34:22 PM

Title: Arcsinus
Post by: jj2007 on December 20, 2020, 09:34:22 PM
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.
Title: Re: Arcsinus
Post by: FORTRANS on December 21, 2020, 12:32:08 AM
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.
Title: Re: Arcsinus
Post by: jj2007 on December 21, 2020, 04:18:31 AM
Thanks, Steve :thup:
Title: Re: Arcsinus
Post by: mabdelouahab on December 21, 2020, 07:46:25 PM
ST(1)= (https://www.animated-smileys.com/emoticons/animated-smileys-sleeping-020.gif.pagespeed.ce.5vA9FHge8N.gif)

:biggrin:
Title: Re: Arcsinus
Post by: jj2007 on December 21, 2020, 09:44:58 PM
Resolved (http://masm32.com/board/index.php?topic=9039.0;topicseen) :biggrin: