Home | History | Annotate | Download | only in detail
      1 ///////////////////////////////////////////////////////////////////////////////////
      2 /// OpenGL Mathematics (glm.g-truc.net)
      3 ///
      4 /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      5 /// Permission is hereby granted, free of charge, to any person obtaining a copy
      6 /// of this software and associated documentation files (the "Software"), to deal
      7 /// in the Software without restriction, including without limitation the rights
      8 /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      9 /// copies of the Software, and to permit persons to whom the Software is
     10 /// furnished to do so, subject to the following conditions:
     11 ///
     12 /// The above copyright notice and this permission notice shall be included in
     13 /// all copies or substantial portions of the Software.
     14 ///
     15 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     21 /// THE SOFTWARE.
     22 ///
     23 /// @ref core
     24 /// @file glm/core/func_common.hpp
     25 /// @date 2008-03-08 / 2010-01-26
     26 /// @author Christophe Riccio
     27 ///
     28 /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     29 ///
     30 /// @defgroup core_func_common Common functions
     31 /// @ingroup core
     32 ///
     33 /// These all operate component-wise. The description is per component.
     34 ///////////////////////////////////////////////////////////////////////////////////
     35 
     36 #ifndef GLM_FUNC_COMMON_INCLUDED
     37 #define GLM_FUNC_COMMON_INCLUDED
     38 
     39 #include "setup.hpp"
     40 #include "precision.hpp"
     41 #include "type_int.hpp"
     42 #include "_fixes.hpp"
     43 
     44 namespace glm
     45 {
     46 	/// @addtogroup core_func_common
     47 	/// @{
     48 
     49 	/// Returns x if x >= 0; otherwise, it returns -x.
     50 	///
     51 	/// @tparam genType floating-point or signed integer; scalar or vector types.
     52 	///
     53 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
     54 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     55 	template <typename genType>
     56 	GLM_FUNC_DECL genType abs(genType const & x);
     57 
     58 	/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
     59 	///
     60 	/// @tparam genType Floating-point or signed integer; scalar or vector types.
     61 	///
     62 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
     63 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     64 	template <typename genType>
     65 	GLM_FUNC_DECL genType sign(genType const & x);
     66 
     67 	/// Returns a value equal to the nearest integer that is less then or equal to x.
     68 	///
     69 	/// @tparam genType Floating-point scalar or vector types.
     70 	///
     71 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
     72 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     73 	template <typename genType>
     74 	GLM_FUNC_DECL genType floor(genType const & x);
     75 
     76 	/// Returns a value equal to the nearest integer to x
     77 	/// whose absolute value is not larger than the absolute value of x.
     78 	///
     79 	/// @tparam genType Floating-point scalar or vector types.
     80 	///
     81 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
     82 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     83 	template <typename genType>
     84 	GLM_FUNC_DECL genType trunc(genType const & x);
     85 
     86 	/// Returns a value equal to the nearest integer to x.
     87 	/// The fraction 0.5 will round in a direction chosen by the
     88 	/// implementation, presumably the direction that is fastest.
     89 	/// This includes the possibility that round(x) returns the
     90 	/// same value as roundEven(x) for all values of x.
     91 	///
     92 	/// @tparam genType Floating-point scalar or vector types.
     93 	///
     94 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
     95 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
     96 	template <typename genType>
     97 	GLM_FUNC_DECL genType round(genType const & x);
     98 
     99 	/// Returns a value equal to the nearest integer to x.
    100 	/// A fractional part of 0.5 will round toward the nearest even
    101 	/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
    102 	///
    103 	/// @tparam genType Floating-point scalar or vector types.
    104 	///
    105 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
    106 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    107 	/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
    108 	template <typename genType>
    109 	GLM_FUNC_DECL genType roundEven(genType const & x);
    110 
    111 	/// Returns a value equal to the nearest integer
    112 	/// that is greater than or equal to x.
    113 	///
    114 	/// @tparam genType Floating-point scalar or vector types.
    115 	///
    116 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
    117 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    118 	template <typename genType>
    119 	GLM_FUNC_DECL genType ceil(genType const & x);
    120 
    121 	/// Return x - floor(x).
    122 	///
    123 	/// @tparam genType Floating-point scalar or vector types.
    124 	///
    125 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
    126 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    127 	template <typename genType>
    128 	GLM_FUNC_DECL genType fract(genType const & x);
    129 
    130 	/// Modulus. Returns x - y * floor(x / y)
    131 	/// for each component in x using the floating point value y.
    132 	///
    133 	/// @tparam genType Floating-point scalar or vector types.
    134 	///
    135 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
    136 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    137 	template <typename genType>
    138 	GLM_FUNC_DECL genType mod(
    139 		genType const & x,
    140 		genType const & y);
    141 
    142 	/// Modulus. Returns x - y * floor(x / y)
    143 	/// for each component in x using the floating point value y.
    144 	///
    145 	/// @tparam genType Floating-point scalar or vector types.
    146 	///
    147 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
    148 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    149 	template <typename genType>
    150 	GLM_FUNC_DECL genType mod(
    151 		genType const & x,
    152 		typename genType::value_type const & y);
    153 
    154 	/// Returns the fractional part of x and sets i to the integer
    155 	/// part (as a whole number floating point value). Both the
    156 	/// return value and the output parameter will have the same
    157 	/// sign as x.
    158 	///
    159 	/// @tparam genType Floating-point scalar or vector types.
    160 	///
    161 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
    162 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    163 	template <typename genType>
    164 	GLM_FUNC_DECL genType modf(
    165 		genType const & x,
    166 		genType & i);
    167 
    168 	/// Returns y if y < x; otherwise, it returns x.
    169 	///
    170 	/// @tparam genType Floating-point or integer; scalar or vector types.
    171 	///
    172 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
    173 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a><<<<<<< HEAD
    174 	template <typename genType>
    175 	GLM_FUNC_DECL genType min(
    176 		genType const & x,
    177 		genType const & y);
    178 
    179 	template <typename genType>
    180 	GLM_FUNC_DECL genType min(
    181 		genType const & x,
    182 		typename genType::value_type const & y);
    183 
    184 	/// Returns y if x < y; otherwise, it returns x.
    185 	///
    186 	/// @tparam genType Floating-point or integer; scalar or vector types.
    187 	///
    188 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
    189 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    190 	template <typename genType>
    191 	GLM_FUNC_DECL genType max(
    192 		genType const & x,
    193 		genType const & y);
    194 
    195 	template <typename genType>
    196 	GLM_FUNC_DECL genType max(
    197 		genType const & x,
    198 		typename genType::value_type const & y);
    199 
    200 	/// Returns min(max(x, minVal), maxVal) for each component in x
    201 	/// using the floating-point values minVal and maxVal.
    202 	///
    203 	/// @tparam genType Floating-point or integer; scalar or vector types.
    204 	///
    205 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
    206 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    207 	template <typename genType>
    208 	GLM_FUNC_DECL genType clamp(
    209 		genType const & x,
    210 		genType const & minVal,
    211 		genType const & maxVal);
    212 
    213 	template <typename genType, precision P>
    214 	GLM_FUNC_DECL genType clamp(
    215 		genType const & x,
    216 		typename genType::value_type const & minVal,
    217 		typename genType::value_type const & maxVal);
    218 
    219 	/// If genTypeU is a floating scalar or vector:
    220 	/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
    221 	/// x and y using the floating-point value a.
    222 	/// The value for a is not restricted to the range [0, 1].
    223 	///
    224 	/// If genTypeU is a boolean scalar or vector:
    225 	/// Selects which vector each returned component comes
    226 	/// from. For a component of <a> that is false, the
    227 	/// corresponding component of x is returned. For a
    228 	/// component of a that is true, the corresponding
    229 	/// component of y is returned. Components of x and y that
    230 	/// are not selected are allowed to be invalid floating point
    231 	/// values and will have no effect on the results. Thus, this
    232 	/// provides different functionality than
    233 	/// genType mix(genType x, genType y, genType(a))
    234 	/// where a is a Boolean vector.
    235 	///
    236 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix man page</a>
    237 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    238 	///
    239 	/// @param[in]  x Value to interpolate.
    240 	/// @param[in]  y Value to interpolate.
    241 	/// @param[in]  a Interpolant.
    242 	///
    243 	/// @tparam	genTypeT Floating point scalar or vector.
    244 	/// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.
    245 	///
    246 	/// @code
    247 	/// #include <glm/glm.hpp>
    248 	/// ...
    249 	/// float a;
    250 	/// bool b;
    251 	/// glm::dvec3 e;
    252 	/// glm::dvec3 f;
    253 	/// glm::vec4 g;
    254 	/// glm::vec4 h;
    255 	/// ...
    256 	/// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.
    257 	/// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h;
    258 	/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.
    259 	/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
    260 	/// @endcode
    261 	template <typename T, typename U, precision P, template <typename, precision> class vecType>
    262 	GLM_FUNC_DECL vecType<T, P> mix(
    263 		vecType<T, P> const & x,
    264 		vecType<T, P> const & y,
    265 		vecType<U, P> const & a);
    266 
    267 	template <typename T, typename U, precision P, template <typename, precision> class vecType>
    268 	GLM_FUNC_DECL vecType<T, P> mix(
    269 		vecType<T, P> const & x,
    270 		vecType<T, P> const & y,
    271 		U const & a);
    272 
    273 	template <typename genTypeT, typename genTypeU>
    274 	GLM_FUNC_DECL genTypeT mix(
    275 		genTypeT const & x,
    276 		genTypeT const & y,
    277 		genTypeU const & a);
    278 
    279 	/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
    280 	///
    281 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
    282 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    283 	template <typename genType>
    284 	GLM_FUNC_DECL genType step(
    285 		genType const & edge,
    286 		genType const & x);
    287 
    288 	/// Returns 0.0 if x < edge, otherwise it returns 1.0.
    289 	///
    290 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
    291 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    292 	template <template <typename, precision> class vecType, typename T, precision P>
    293 	GLM_FUNC_DECL vecType<T, P> step(
    294 		T const & edge,
    295 		vecType<T, P> const & x);
    296 
    297 	/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
    298 	/// performs smooth Hermite interpolation between 0 and 1
    299 	/// when edge0 < x < edge1. This is useful in cases where
    300 	/// you would want a threshold function with a smooth
    301 	/// transition. This is equivalent to:
    302 	/// genType t;
    303 	/// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
    304 	/// return t * t * (3 - 2 * t);
    305 	/// Results are undefined if edge0 >= edge1.
    306 	///
    307 	/// @tparam genType Floating-point scalar or vector types.
    308 	///
    309 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
    310 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    311 	template <typename genType>
    312 	GLM_FUNC_DECL genType smoothstep(
    313 		genType const & edge0,
    314 		genType const & edge1,
    315 		genType const & x);
    316 
    317 	template <typename genType>
    318 	GLM_FUNC_DECL genType smoothstep(
    319 		typename genType::value_type const & edge0,
    320 		typename genType::value_type const & edge1,
    321 		genType const & x);
    322 
    323 	/// Returns true if x holds a NaN (not a number)
    324 	/// representation in the underlying implementation's set of
    325 	/// floating point representations. Returns false otherwise,
    326 	/// including for implementations with no NaN
    327 	/// representations.
    328 	///
    329 	/// /!\ When using compiler fast math, this function may fail.
    330 	///
    331 	/// @tparam genType Floating-point scalar or vector types.
    332 	///
    333 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
    334 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    335 	template <typename genType>
    336 	GLM_FUNC_DECL typename genType::bool_type isnan(genType const & x);
    337 
    338 	/// Returns true if x holds a positive infinity or negative
    339 	/// infinity representation in the underlying implementation's
    340 	/// set of floating point representations. Returns false
    341 	/// otherwise, including for implementations with no infinity
    342 	/// representations.
    343 	///
    344 	/// @tparam genType Floating-point scalar or vector types.
    345 	///
    346 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
    347 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    348 	template <typename genType>
    349 	GLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);
    350 
    351 	/// Returns a signed integer value representing
    352 	/// the encoding of a floating-point value. The floating-point
    353 	/// value's bit-level representation is preserved.
    354 	///
    355 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
    356 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    357 	GLM_FUNC_DECL int floatBitsToInt(float const & v);
    358 
    359 	/// Returns a signed integer value representing
    360 	/// the encoding of a floating-point value. The floatingpoint
    361 	/// value's bit-level representation is preserved.
    362 	///
    363 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
    364 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    365 	template <template <typename, precision> class vecType, precision P>
    366 	GLM_FUNC_DECL vecType<int, P> floatBitsToInt(vecType<float, P> const & v);
    367 
    368 	/// Returns a unsigned integer value representing
    369 	/// the encoding of a floating-point value. The floatingpoint
    370 	/// value's bit-level representation is preserved.
    371 	///
    372 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
    373 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    374 	GLM_FUNC_DECL uint floatBitsToUint(float const & v);
    375 
    376 	/// Returns a unsigned integer value representing
    377 	/// the encoding of a floating-point value. The floatingpoint
    378 	/// value's bit-level representation is preserved.
    379 	///
    380 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
    381 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    382 	template <template <typename, precision> class vecType, precision P>
    383 	GLM_FUNC_DECL vecType<uint, P> floatBitsToUint(vecType<float, P> const & v);
    384 
    385 	/// Returns a floating-point value corresponding to a signed
    386 	/// integer encoding of a floating-point value.
    387 	/// If an inf or NaN is passed in, it will not signal, and the
    388 	/// resulting floating point value is unspecified. Otherwise,
    389 	/// the bit-level representation is preserved.
    390 	///
    391 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
    392 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    393 	GLM_FUNC_DECL float intBitsToFloat(int const & v);
    394 
    395 	/// Returns a floating-point value corresponding to a signed
    396 	/// integer encoding of a floating-point value.
    397 	/// If an inf or NaN is passed in, it will not signal, and the
    398 	/// resulting floating point value is unspecified. Otherwise,
    399 	/// the bit-level representation is preserved.
    400 	///
    401 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
    402 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    403 	template <template <typename, precision> class vecType, precision P>
    404 	GLM_FUNC_DECL vecType<float, P> intBitsToFloat(vecType<int, P> const & v);
    405 
    406 	/// Returns a floating-point value corresponding to a
    407 	/// unsigned integer encoding of a floating-point value.
    408 	/// If an inf or NaN is passed in, it will not signal, and the
    409 	/// resulting floating point value is unspecified. Otherwise,
    410 	/// the bit-level representation is preserved.
    411 	///
    412 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
    413 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    414 	GLM_FUNC_DECL float uintBitsToFloat(uint const & v);
    415 
    416 	/// Returns a floating-point value corresponding to a
    417 	/// unsigned integer encoding of a floating-point value.
    418 	/// If an inf or NaN is passed in, it will not signal, and the
    419 	/// resulting floating point value is unspecified. Otherwise,
    420 	/// the bit-level representation is preserved.
    421 	///
    422 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
    423 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    424 	template <template <typename, precision> class vecType, precision P>
    425 	GLM_FUNC_DECL vecType<float, P> uintBitsToFloat(vecType<uint, P> const & v);
    426 
    427 	/// Computes and returns a * b + c.
    428 	///
    429 	/// @tparam genType Floating-point scalar or vector types.
    430 	///
    431 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
    432 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    433 	template <typename genType>
    434 	GLM_FUNC_DECL genType fma(genType const & a, genType const & b, genType const & c);
    435 
    436 	/// Splits x into a floating-point significand in the range
    437 	/// [0.5, 1.0) and an integral exponent of two, such that:
    438 	/// x = significand * exp(2, exponent)
    439 	///
    440 	/// The significand is returned by the function and the
    441 	/// exponent is returned in the parameter exp. For a
    442 	/// floating-point value of zero, the significant and exponent
    443 	/// are both zero. For a floating-point value that is an
    444 	/// infinity or is not a number, the results are undefined.
    445 	///
    446 	/// @tparam genType Floating-point scalar or vector types.
    447 	///
    448 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
    449 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    450 	template <typename genType, typename genIType>
    451 	GLM_FUNC_DECL genType frexp(genType const & x, genIType & exp);
    452 
    453 	/// Builds a floating-point number from x and the
    454 	/// corresponding integral exponent of two in exp, returning:
    455 	/// significand * exp(2, exponent)
    456 	///
    457 	/// If this product is too large to be represented in the
    458 	/// floating-point type, the result is undefined.
    459 	///
    460 	/// @tparam genType Floating-point scalar or vector types.
    461 	///
    462 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
    463 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
    464 	template <typename genType, typename genIType>
    465 	GLM_FUNC_DECL genType ldexp(genType const & x, genIType const & exp);
    466 
    467 	/// @}
    468 }//namespace glm
    469 
    470 #include "func_common.inl"
    471 
    472 #endif//GLM_FUNC_COMMON_INCLUDED
    473