10.02.2014 Views

spec - OpenGL

spec - OpenGL

spec - OpenGL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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 <strong>spec</strong>ified.) Most single-precision<br />

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

The <strong>spec</strong>ial values Inf and −Inf encode values with magnitudes too large to<br />

be represented; the <strong>spec</strong>ial 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 un<strong>spec</strong>ified, 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 un<strong>spec</strong>ified 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 />

32768<br />

⌊ ⌋<br />

N mod 32768<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 un<strong>spec</strong>ified, but<br />

<strong>OpenGL</strong> 4.2 (Compatibility Profile) - August 22, 2011

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

Saved successfully!

Ooh no, something went wrong!