Graphics Reference
In-Depth Information
fixed-point format is constant. Developers need to be aware of
these precision issues when choosing which data type to use when
generating coordinates for a particular format.
Figure A-1 describes the representation of a half-float number. A half-float
is a 16-bit floating-point number with 10 bits of mantissa
m
, 5 bits of
exponent
e
, and a sign bit
s
.
s
exponent (e)
mantissa (m)
15
14 10 9 0
Figure A-1
A 16-Bit Floating-Point Number
The following rules should be used when interpreting a 16-bit floating-
point number:
• If exponent e is between 1 and 30, the half-float value is computed as
(- l)
s
* 2
e-15
* (1 + m/1024).
• If exponent e and mantissa m are both 0, the half-float value is 0.0.
The sign bit is used to represent -ve 0.0 or +ve 0.0.
• If exponent e is 0 and mantissa m is not 0, the half-float value is a
denormalized number.
• If exponent e is 31, the half-float value is either infinity (+ve or -ve)
or a NaN (“not a number”) depending on whether the mantissa m is
zero.
A few examples follow:
0 00000 0000000000 = 0.0
0 00000 0000001111 = a denorm value
0 11111 0000000000 = positive infinity
1 11111 0000000000 = negative infinity
0 11111 0000011000 = NaN
1 11111 1111111111 = NaN
0 01111 0000000000 = 1.0
1 01110 0000000000 = −0.5
0 10100 1010101010 = 54.375
OpenGL ES 3.0 implementations must be able to accept input half-float
data values that are infinity, NaN, or denormalized numbers. They do not