Smalltalk/X WebserverDocumentation of class 'BFloat16Array': | |||
Class: BFloat16ArrayInheritance:Object | +--Collection | +--SequenceableCollection | +--ArrayedCollection | +--UninterpretedBytes | +--AbstractNumberVector | +--UnboxedFloatArray | +--BFloat16Array
Description:BFloat16Arrays store half precision (16bit) bfloats (and nothing else). These are similar to HalfFloats, but have a full 8bit exponent and a very reduced mantissa (8 bit). Thus, they have the same number range as single precision floats, but much less precision. (as opposed to HalfFloats, which provide slighly more precision, but a smaller range). BFloat16s are heavily used in machine learning and graphic (GPU) algorithms, and some modern CPUs support them natively in hardware. Notice, that BFloat16s are not supported as first class objects by the ST/X system; i.e. outside of a BFloat16Array, these values are represented as floats or doubles. When accessing a BFloat16Array's element via getters/setters, shortFloat (i.e. single precision 32bit floats) are exchanged. Be aware that the precision of a bfloat16 is very very limited, although the numeric range is that of a single precision-float. Citation form wikipedia: Bfloat16 is designed to maintain the number range from the 32-bit IEEE 754 single-precision floating-point format (binary32), while reducing the precision from 24 bits to 8 bits. This means that the precision is between two and three decimal digits, and bfloat16 can represent finite values up to about 3.4 × 10^38. BFloat16Arrays can be used as literals i.e. you can enter BFloat16Array-constants as: #fb16( element1 element2 .... elementN ) for example: #fb16(1 2.0 3 4.0) [memory requirements:] OBJ-HEADER + (size * 2) [complexity:] see Array Class protocol:queries
Instance protocol:accessing
|
|||
ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:11:43 GMT |