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