QBasic 1.1: ATN Function
Explanation
ATN, COS, SIN, TAN Functions
ATN returns the absolute value of a number.
COS, SIN, and TAN return the cosine, sine, and tangent of a specified angle.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
ATN(numeric-expression) |
COS(angle) |
SIN(angle) |
TAN(angle) |
Description / Parameter(s)
numeric-expression |
The ratio between the sides of a right triangle |
angle |
An angle expressed in radians |
The ATN function returns an angle in radians |
To convert from degrees to radians, multiply degrees by (PI / 180) |
Example
CONST PI=3.141592654
PRINT ATN(TAN(PI/4.0)), PI/4.0 'Output is: .7853981635 .7853981635
PRINT (COS(180 * (PI / 180))) 'Output is: -1
PRINT (SIN(90 * (PI / 180))) 'Output is: 1
PRINT (TAN(45 * (PI / 180))) 'Output is: 1.000000000205103