Commodore‎ > ‎BASIC‎ > ‎Keywords‎ > ‎

SIN

Keyword Abbreviation Token (hex) Version(s) Classification
SIN S{Shift+I} BF 1.0+ Function

  Syntax  
SIN angle )
 
Parameters Type Legal Value(s) Default Value Note(s)
angle Numeric
any
measured in radians
 
Returns Type Value(s) Note(s)
deltaY Floating-point
-1 to 1
also called the rise
 
  Purpose  
Calculate the trignometric sine (deltaY) of an angle (in radians).

 
  Remarks  
The SIN function returns deltaY which is a scaled version of the rise in the formula: slope = rise / run.  It most useful to calculate the Y component during polar to rectangular conversion.  May also be used to calculate the imaginary part of a complex number.  Because deltaY is a scaled version (based on a unit circle), to get the actual Y (or the actual rise), you need to multiply the returned value by the actual magnitude of the polar coordinate (or length of the slope).
 
Because of the nature of angles, the value of this function repeats itself with a "period" of 2*π radians or 360 degrees (approximately 6.28318531).  Because SIN needs an angle in radians, first multiple by π/180 if you are using degrees.
 
You will get TYPE MISMATCH ERROR with a string value.
 
SIN should not be confused SGN which returns a completely different value (the arithmetic sign).
  
Examples:
PRINT SIN(π/180*30)
 .5
 
READY.
PRINT SIN(π/180*45)
 .707106781

READY.
PRINT SIN(π/180*90)
 1

READY.
  
  Contrast With  
 
  See Also  
SQR, TAN 

© H2Obsession, 2014
Comments