eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HalfFloatArray':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HalfFloatArray


Inheritance:

   Object
   |
   +--Collection
      |
      +--SequenceableCollection
         |
         +--ArrayedCollection
            |
            +--UninterpretedBytes
               |
               +--AbstractNumberVector
                  |
                  +--UnboxedFloatArray
                     |
                     +--HalfFloatArray

Package:
stx:libbasic2
Category:
Collections-Arrayed
Version:
rev: 1.17 date: 2019/07/19 15:25:54
user: cg
file: HalfFloatArray.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Claus Gittinger

Description:


HalfFloatArrays store half precision (16bit) floats (and nothing else).
HalfFloats were traditionally seldom used, but seem to become more popular
these days, as some 3D graphics accelerators and game engines use them
for very dense and compact storage of texture and vertex data.

Notice, that HalfFloats are not supported as first class objects by the ST/X system;
i.e. outside of a HalfFloatArray, these values are represented as floats
or doubles. When accessing a HalfFloatArray's element via getters/setters,
shortFloat (i.e. single precision 32bit floats) are exchanged.

Be aware that the numeric range of a half-float is very very limited.

[memory requirements:]
    OBJ-HEADER + (size * 2)


Related information:

    FloatArray
    DoubleArray
    Array
    http://www.opengl.org/wiki/Small_Float_Formats
    [ttps]

Class protocol:

queries
o  elementByteSize
for bit-like containers, return the number of bytes stored per element.
Here, 2 is returned

o  epsilon
return the maximum relative spacing of elements of mySelf
(i.e. the value-delta of the least significant bit)

usage example(s):

     HalfFloatArray epsilon printStringScientific

o  precision
answer the precision (the number of bits in the mantissa) of my elements (in bits)
This is an IEEE halffloat, where only the fraction from the normalized mantissa is stored
and so there is a hidden bit and the mantissa is actually represented by 11 binary digits
(although only 10 are needed in the binary representation)


Instance protocol:

accessing
o  at: index

o  at: index put: aFloat
arrive here only in case of an error

queries
o  defaultElement

o  isValidElement: anObject
return true, if I can hold this kind of object

o  numFloats

testing
o  isFloatArray
return true if the receiver has float elements.
These are Float, Double- and HalfFloat arrays



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Tue, 19 Mar 2024 11:28:21 GMT