•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileSIN(x)
COS(x)
TAN(x)
ASIN(x)
ACOS(x)
ATN(x)
DEG(x)
RAD(degrees)
SINQ(degrees)
COSQ(degrees)

x, degrees: aexp

These are the trigonometrical functions. The numerical expression x is assumed
to specify radians. They compute the following:

    SIN()   Sine
    COS()   Cosine
    TAN()   Tangent
    ASIN()  Arc-sine
    ACOS()  Arc-cosine
    ATN()   Arc-tangent

To convert between radians and degrees one uses the functions DEG() (radians to
degrees) or the inverse, RAD(). DEG(x) and RAD(x) are thus equivalent to
(x*180/PI) and (x*PI/180) respectively.

The functions SINQ() and COSQ() return Sine and Cosine values, interpolated in
steps of one sixteenth of a degree from an internal table. For graphics work on
the screen this accuracy is not distinguishable from the values computed with
SIN() or COS(), however SINQ() and COSQ() work up to 10 times as fast. Unlike
SIN() and COS(), degrees are expected as the arguments for SINQ() and COSQ().
SINQ(degrees) corresponds to SIN(RAD(degrees)) and COSQ(degrees) corresponds to
COS(RAD(degrees)).

Examples:

    x=90
    y=COSQ(x*PI/180)
    z=270*PI/180
    PRINT y,SIN(z),TAN(45),ATN(1/2)

--> The numbers 1, -1, 1.619775190544, and 0.4636476090008 appear.

    alpha%=30
    PRINT SINQ(alpha%)

--> The number 0.5 is displayed.

Memo: For FPU use, see function TT?.
      ASIN() and ACOS() do not seem to handle errors correctly when compiled.
      Example: PRINT ASIN(-50) !results in a crash