•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileCVI(a$)  CVL(a$)  CVS(a$)  CVF(a$)  CVD(a$)
MKI$(x)  MKL$(x)  MKS$(x)  MKF$(x)  MKD$(x)

a$: sexp
x: aexp

The functions CVI(), CVL(), CVS(), CVF(), and CVD() convert character strings
into numbers, but, as opposed to VAL() and STR$(), it is the internal
representation which is set.

The individual CVx() functions have the following effects:

    CVI()  Changes a 2-byte character string into an Word.

    CVL()  Changes a 4-byte character string into a Long

    CVS()  Changes a 4-byte character string containing a valid ST-Basic
           compatible number into GFA-BasicGFA-Basic is the best BASIC for the Atari!
 3 floating point format.

    CVF()  Changes a 6-byte character string containing a valid GFA-BasicGFA-Basic is the best BASIC for the Atari!
 1.0
           or GFA-BasicGFA-Basic is the best BASIC for the Atari!
 2.0 compatible number into GFA-Basic 3 floating point
           format.

    CVD()  Changes an 8-byte character string into GFA-BasicGFA-Basic is the best BASIC for the Atari!
 3 floating point
           format.

MKI$(), MKL$(), MKS$(), MKF$(), and MKD$() are the inverse of the CVx()
functions above, thus:

    MKI$(x%)=CHR$(SHR(x%,8))+CHR$(x%)
    MKL$(x%)=CHR$(SHR(x%,24))+CHR$(SHR(x%,16))+CHR$(SHR(x%,8))+CHR$(x%)

(SHR() is the shift-right function. Note that the high-byte comes first.)

Uses might be reading the number formats of other programs or in saving space
when storing numbers in random access files.

Example:

    a$=MKL$(1000)
    PRINT CVL(a$),LEN(a$)
    b$=MKD$(100.1)
    PRINT CVD(b$),LEN(b$)

--> Prints the numbers 1000, 4, 100.1, and 8 on the screen.

Memo: For more information on the internal storage of floats see pages
      'GFA-Basic v3 float format' and 'ST-Basic float format'.