•  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-File
 31                     8 7 6     0
 mmmmmmmmmmmmmmmmmmmmmmmm s eeeeeee

 m = mantissa
 s = sign bit
 e = exponent

Note: Maximum of 5 decimal places: '0.12345'

--------------------------------------------------------------------------------

From: http://alvyn.sourceforge.net/amos_file_formats.html

    * 4 bytes: the single-precision floating point value.
          o bits 31-8: mantissa (24 bits)
          o bit 7: sign bit. Positive if 0, negative if 1
          o bits 6-0: exponent

An exponent of 0 means 0.0, regardless of mantissa.
Counting from MSB (23) to LSB (0),
each bit set in the mantissa is 2^(mantissa_bit + exponent - 88)

--------------------------------------------------------------------------------

From: http://www.atari-forum.com/wiki/index.php/STOS.BAS

1 long: number value - 1st 24 bits are the mantissa, 
                       25th bit is the sign,
                       last 7 bits are the exponent

Note: to convert to a readable format,
each bit of the mantissa = 2 ^ (bit_position + exponent - 88.0).
Add up the values indicated by each bit in the mantissa.


FUNCTION get_float(VAR p%)
  LOCAL s!
  LOCAL e&,b&
  LOCAL d%,m%
  LOCAL f
  f=FALSE
  d%=LONG{p%}
  m%=SHR(d%,8)    !mantissa
  s!=BTST(d%,7)   !sign
  e&=AND(d%,&H7F) !exponent
  IF e&>FALSE     !fix?
    FOR b&=23 DOWNTO 0
      IF BTST(m%,b&)=TRUE
        f=f+(2^(b&+e&-88))
      ENDIF
    NEXT b&
  ENDIF
  IF s!=TRUE      !negative?
    f=-f
  ENDIF
  ADD p%,4
  RETURN ROUND(f,5) !clip
ENDFUNC