MSX BASIC – lesson 6

da | November 20, 2020 | MSX BASIC

“MSX BASIC” COLUMN by Orazio Cacciola (part 6)

Mathematical functions and more

In this episode I will give an overview of those functions that we will use very little but which are convenient to know and what they are for.

ABS: Returns the absolute value of the calculation of 2 or more numeric data. This means that it will always give a positive value in any case.
Syntax: ABS(AB)

ATN: Returns the value of the arctangent, whose argument(N) is expressed in radians.
Syntax: ATN(N)

COS: Returns the cosine value always expressed in radians.
Syntax: COS(N)

EXP: Calculates the exponential value.
Syntax: EXP(N)

LOG: Return the logarithm of the number or variable of the N argument.
Syntax: LOG(N)

SNG: Returns the sign of a number or variable. If it is positive, it will give 1, if it is negative it will be -1, it will be 0 if this is equal to zero.
Syntax: SNG(N)

SIN: Like the COS function, returns the value of the sine.
Syntax: SIN(N)

SQR: Returns the square root of a number or variable.
Syntax: SQR(N)

TAN: Returns the tangent of a number or variable always in radians.
Syntax: TAN(N)

CINT: Rounds value N to an integer. The value must vary between -32768 and 32767
Syntax: CINT(N)

FIX; Indicates the integer part of N
Syntax: FIX(N)

VAL; Converts a string to a numeric value, this is if the first character of the string is a number or a recognition sign for other numeric systems (See 3rd part:
The Systems; Binary, Octal and Hexadecimal). Remember that, if the converted number has been placed in a variable and this has been named as an integer, it must not exceed
value of the integers, otherwise our MSX will report it with an error message: Overflow
Syntax: VAL(N)

Thanks and see you next time.