Home > CBM > BASIC > Keywords > Tan 180 Subpages: (divide), (equal), (less), (minus), (more), (multiply), (plus), (power), Abs, And, Append, Asc, Atn, Auto, Backup, Bank, Begin, Bend, Bload, Boot, Box, Bsave, Bump, Catalog, Char, Chr, Circle, Close, Clr, Cmd, Collect, Collision, Color, Concat, Cont, Copy, Cos, Data, Dclear, Dclose, Dec, Def, Delete, Dim, Directory, Dispose, Dload, Do, Dopen, Draw, Ds, Ds string, Dsave, Dverify, El, Else, End, Envelope, Er, Err, Exit, Exp, Fast, Fetch, Filter, Fn, For, Fre, Get, Get num, Getkey, Go, Gosub, Goto, Graphic, Gshape, Header, Help, Hex, If, Input, Input num, Instr, Int, Joy, Key, Left, Len, Let, List, Load, Locate, Log, Loop, Mid, Monitor, Movspr, New, Next, Not, Off, On, Open, Or, Paint, Peek, Pen, Pi, Play, Pointer, Poke, Pos, Pot, Print, Print num, Pudef, Quit, Rclr, Rdot, Read, Record, Rem, Rename, Renumber, Restore, Resume, Return, Rgr, Right, Rlum, Rnd, Rreg, Rspcolor, Rsppos, Rsprite, Run, Rwindow, Save, Scale, Scnclr, Scratch, Sgn, Sin, Sleep, Slow, Sound, Spc, Sprcolor, Sprdef, Sprite, Sprsav, Sqr, Sshape, St, Stash, Step, Stop, Str, Swap, Sys, Tab, Tempo, Then, Ti, Ti string, To, Trap, Troff, Tron, Until, Using, Usr, Val, Verify, Vol, Wait, While, Width, Window, Xor |
| Keyword | Abbreviation | Token (hex) | Version(s) | Classification |
| TAN | none | C0 | 1.0+ | Function |
TAN( angle )
| Parameters | Type | Legal Value(s) | Default Value | Note(s) |
| angle | Numeric | any but an odd integer multiple of π/2 | | measured in radians |
| Returns | Type | Value(s) | Note(s) |
| slope | Floating-point | any | rise/run |
Calculate the triginometric tangent (slope) of an angle (in radians).
The TAN function returns the slope of an angle, which is occassionally useful
in things like trigonometry. A slope of 0 is horizontal, a slope of 1 has an equal
rise-to-run ratio, and a perfectly vertical slope is infinite.
Because CBM BASIC doesn't allow infinite values, any odd multiple of 90 degrees (π/2 radians)),
should return OVERFLOW ERROR, but actually the only thing I have ever seen is DIVISION BY ZERO,
which is misleading.
The value of TAN (the slope) can be easily derived from the SIN and COS functions;
if their values are S and C respectively for angle, then you can "manually" calculate
TAN(angle) as C / S. The "manual" method is much faster if you already have C and S.
Usually if you have one of them, you probably have the other (or it would be handy to have the other).
Because of the nature of angles, the value of this function repeats itself with a "period"
of π radians (approximately 3.14159265) or 180 degrees; TAN is a never-ending repetion
of the inverted ATN function. Because TAN needs an angle in radians,
first multiple by π/180 if you are using degrees.
Note the trignometric tangent (TAN) has almost no relation to the concept of a geometric tangent
(where a line just touches a curve).
You will get TYPE MISMATCH ERROR with a string value.
Examples:
PRINT TAN(π/180*30)
.577350269
READY.
PRINT TAN(π/180*45)
.999999999
READY.
PRINT TAN(π/180*90)
?DIVISION BY ZERO ERROR
READY.
|
ATN
COS, SIN
© H2Obsession, 2014 |