21.06.2014 Views

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.1. OPENGL FUNDAMENTALS 8<br />

point operations are accurate to about 1 part in 10 5 . The maximum representable<br />

magnitude for all floating-point values must be at least 2 32 . x · 0 = 0 · x = 0 for<br />

any non-infinite and non-NaN x. 1 · x = x · 1 = x. x + 0 = 0 + x = x. 0 0 =<br />

1. (Occasionally further requirements will be specified.) Most single-precision<br />

floating-point formats meet these requirements.<br />

The special values Inf and −Inf encode values with magnitudes too large to<br />

be represented; the special value NaN encodes “Not A Number” values resulting<br />

from undefined arithmetic operations such as 0 0<br />

. Implementations are permitted,<br />

but not required, to support Inf s and NaN s in their floating-point computations.<br />

Any representable floating-point value is legal as input to a GL command that<br />

requires floating-point data. The result of providing a value that is not a floatingpoint<br />

number to such a command is unspecified, but must not lead to GL interruption<br />

or termination. In IEEE arithmetic, for example, providing a negative zero or a<br />

denormalized number to a GL command yields predictable results, while providing<br />

a NaN or an infinity yields unspecified results.<br />

16-Bit Floating-Point Numbers<br />

A 16-bit floating-point number has a 1-bit sign (S), a 5-bit exponent (E), and a<br />

10-bit mantissa (M). The value V of a 16-bit floating-point number is determined<br />

by the following:<br />

⎧<br />

(−1) S × 0.0, E = 0, M = 0<br />

⎪⎨ (−1) S × 2 −14 × M , E = 0, M ≠ 0<br />

2 10<br />

V = (−1) S × 2 E−15 × ( 1 + M )<br />

2 , 0 < E < 31<br />

10<br />

(−1)<br />

⎪⎩<br />

S × Inf , E = 31, M = 0<br />

NaN , E = 31, M ≠ 0<br />

If the floating-point number is interpreted as an unsigned 16-bit integer N, then<br />

⌊ ⌋<br />

N mod 65536<br />

S =<br />

3<strong>27</strong>68<br />

⌊ ⌋<br />

N mod 3<strong>27</strong>68<br />

E =<br />

1024<br />

M = N mod 1024.<br />

Any representable 16-bit floating-point value is legal as input to a GL command<br />

that accepts 16-bit floating-point data. The result of providing a value that is not a<br />

floating-point number (such as Inf or NaN ) to such a command is unspecified, but<br />

<strong>OpenGL</strong> <strong>4.2</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>April</strong> <strong>27</strong>, <strong>2012</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!