Order this information in Print

Order this information on CD-ROM

Download in PDF Format

     

Click here to make tpub.com your Home Page

Page Title: Predefine Functions
Back | Up | Next

tpub.com Updates

Google


Web
www.tpub.com

Home

   
Information Categories
.... Administration
Advancement
Aerographer
Automotive
Aviation
Combat
Construction
Diving
Draftsman
Engineering
Electronics
Food and Cooking
Math
Medical
Music
Nuclear Fundamentals
Photography
Religion
USMC
   
Products
  Educational CD-ROM's
Printed Manuals
Downloadable Books
   

 

Back
The BASIC Character Set
Up
Introduction to Programming
Next
Assigning Statement Numbers

Back ] Home ] Up ] Next ]

Predefine Functions

Some mathematical functions, for example, square root and tangent, are used so frequently that they have been incorporated into the BASIC language as predefine functions. You can use these to compute the same mathematical function with many different values. Rather than writing the coding required to do each calculation, you may use the "function" capability of the BASIC language. For example:

This will cause the computer to calculate the square root of 36 and assign that value to X. Table 2-4 shows a list of some of these predefine mathematical functions.

Table 2-4.—Predefined Functions

FUNCTION 

ABS (X) 

ATN (X) 

COS (X) 

EXP (X) 

INT (X) 

LOG (X) 

RND (X) 

SGN (X) 

SIN (X) 

SQR (X) 

TAN (X)

DESCRIPTION

Absolute value of X

Arc tangent of X in radian measure

Cosine of X in radian measure

Natural exponential of X

The largest integer not greater than X

Natural logarithm of X (base e)

Generates random numbers between 0 and 1

Algebraic "sign" of X: -1 if X<0, 0 if X=0, and +1 if X>0

Sine of X in radian measure

Square root of X

Tangent of X in radian measure

FUNDAMENTAL CONCEPTS

Up to this point, we have been discussing the mechanics of the BASIC programming language. We will now discuss fundamental concepts and how you use these in your interaction with the computer in keying in and running your programs. This will include more about statement numbers, spacing within statements, keying statements into the computer, methods of correcting mistakes, how the computer responds when your program contains a syntax error, and the use of the REMARK statement.

Back ] Home ] Up ] Next ]

 

Privacy Statement - Press Release - Copyright Information. - Contact Us - Support Integrated Publishing