MSX BASIC – lesson 6

da | Nov 20, 2023 | MSX BASIC | 0 comments

“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.

0 Comments

Submit a Comment

Your email address will not be published. I campi obbligatori sono contrassegnati *

LEZIONE 26 – INTERVAL ON, RND ED ALTRI

LESSON 26 – INTERVAL ON, RND AND OTHERS

Good morning everyone, In this episode I will talk about an important interrupt, especially for games, when we want to make an enemy suddenly appear or a useful object, but also to create a stopwatch or a clock and many other things. The COMMAND exploits the...

LEZIONE 26 – INTERVAL ON, RND ED ALTRI

LESSON 24 – THE DATA MANAGED BY THE MSX (PART 3)

Kind regards to everyone. Today we will close this topic, I will talk about direct or random access files. But first, as I mentioned in the last episode, I will give a small explanation about the program. First of all, the first thing to say is that I used a command which...