English
Language : 

NSB8 Datasheet, PDF (73/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
ITALIAN TECHNOLOGY
grifo®
FUNCTIONS
BUILT IN FUNCTIONS
When you want to compute the cosine or the square root of a number within your program, how can
you do this? Of course, it’s always possible to write a subroutine in BASIC to compute the cosine
or square root of an arbitrary number, but doing so consumes your time, is likely to slow down your
program if the particular computation is needed often, and certainly enlarges the program.
BASIC inludes built-in functions, two of which handle cosine and square root calculations,
respectively. The other available built-in functions compute many different values, both numeric
and string, which programmers often need, and whose availability makes the task of writing efficient
programs easier.
When writing a program, if you need the cosine of 0, write COS(0). If you want the square root of
9, use SQRT(9). The function can be used in a program wherever the actual number can. COS(0)
stands for (and can be used in place of) the number 1. Writing SQRT(9) is the same as writing 3.
ARGUMENTS
The value in parentheses in a function call is called an argument to the function. The function will
use the value(s) of the specified argument(s) to generate the function value. SQRT(4), for example,
uses the numeric value 4 to generate its square root, 2.
All functions in NSB8 require at least one argument, and some may require more. If a function
requires more than one argument, it will expect them to be separated by commas to form an argument
list within the parentheses.
Expressions can be used as arguments. COS(2*7) represents the same number as COS(14). If the
variable A contains the number 14, then COS(A) also is the same as COS(14).
Functions can be used in expressions. Thus, the statement
A=2*SQRT(100)
would put the value of 20 in A.
Because expressions can be arguments, and functions can be expressions, functions can be used as
arguments. COS(SQRT(100)/10-1) is the same as COS(0).
You must supply functions with the exact number and types of arguments they require, in exactly
the order required, or else when the program runs and the erroneous function call is found, BASIC
will halt execution and complain of a SYNTAX ERROR. Such an error will occur, for example, if
you attempt to use SQRT(“HI”) in a program or direct statement. The SQRT function wants a
numeric argument, and “HI” is a string (see section USING STRINGS). COS(2,3) causes a
SYNTAX ERROR because the COS function wants only one numeric argument.
The following pages contain a list and description of all the functions built into NSB8. Each function
description includes the name of the function, the order of expected arguments, as well as the type
(numeric or string) and purpose of each. A short section describes the value represented by the
function as well as how the arguments relate to that value.
NSB8
Rel. 5.10
Page 61