News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Arcsinus

Started by jj2007, December 20, 2020, 09:34:22 PM

Previous topic - Next topic

jj2007

Raymond Filiatreault, Simply FPU, Chapter 10:

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.

FORTRANS

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.

jj2007


mabdelouahab


jj2007