|
Class: HalfFloat
Object
|
+--Magnitude
|
+--ArithmeticValue
|
+--Number
|
+--LimitedPrecisionReal
|
+--HalfFloat
- Package:
- stx:libbasic2
- Category:
- Magnitude-Numbers
- Version:
- rev:
1.13
date: 2021/11/23 16:25:12
- user: cg
- file: HalfFloat.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
HalfFloats represent rational numbers with very very limited precision.
There are no instances of it to be created - halfFloats are only possibly stored
inside instancs of HalfFloatArray, which are presented as floats or shortFloats when accessd.
However, this class is provided for queries about precision, bits in mantissa etc.
Representation (IEEE s10e5 binary16):
16bit single precision IEEE floats
10 bit fraction + 1 hidden bit, providing a precision of 11bits,
5 bit exponent,
3 decimal digits (approx.)
Range and Precision of Storage Formats: see LimitedPrecisionReal >> documentation
copyrightCOPYRIGHT (c) 2018 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
constants & defaults
-
NaN
-
(comment from inherited method)
return the constant NaN (not a Number) in my representation.
Here, based on the assumption that division of zero by zero generates a NaN
(which is defined as such in the IEEE standard).
If a subclass does not, it has to redefine this method and generate a NaN differently
-
infinity
-
(comment from inherited method)
return an instance of myself which represents positive infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite
-
negativeInfinity
-
(comment from inherited method)
return an instance of myself which represents negative infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite
-
unity
-
(comment from inherited method)
return something which represents the unity element (for my instances).
That is the neutral element for multiplication.
-
zero
-
there are no instances of me in the system;
however, for fmax computation, it is needed.
errors
-
errorNoInstances
-
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
queries
-
fmin
-
the smallest normalized non-zero value which can be represented
by instances of this class;
should actually be sent to the instance,
because some of my subclasses have an instance-specific representation.
Here, compute it and return a Float (there are no instances of HalfFloat)
-
isAbstract
-
Return if this class is an abstract class.
Usage example(s):
-
numBitsInExponent
-
answer the number of bits in the exponent
This is an IEEE float, where 4 bits are available:
seeeeemm mmmmmmmm
Usage example(s):
HalfFloat numBitsInExponent 5
HalfFloat numBitsInMantissa 10
HalfFloat numHiddenBits 1
HalfFloat eBias 15
HalfFloat emin -14
HalfFloat emax 15
HalfFloat fmin
HalfFloat fmax
|
-
numBitsInMantissa
-
answer the number of bits in the mantissa (the significant).
This is an IEEE binary16, where 11 bits are available.
The hidden bit is not counted here.
seeeeemm mmmmmmmm
-
radix
-
answer the radix of a Float's exponent
This is an IEEE float, which is represented as binary
|