LDEXP(3clc)
π NAME π
okay so bestie, this is ldexp from the OpenCL Manual β and what it does is literally multiply x by 2 to the power k. that's it. that's the whole vibe. exponent queen behavior π
here's every single signature, character for character, no edits, no notes:
floatn ldexp(floatn x, intn k);
floatn ldexp(floatn x, int k);
float ldexp(float x, int k);
doublen ldexp(doublen x, intn k);
doublen ldexp(doublen x, int k);
double ldexp(double x, int n);
halfn ldexp(halfn x, intn k);
halfn ldexp(halfn x, int k);
half ldexp(half x, int k);
β¨ DESCRIPTION β¨
Multiply x by 2 to the power k. π that's the function. it's giving "just a lil scaling by a power of two" and honestly? iconic.
π NOTES π
okay so the tea, and you need this tea:
- the vector versions of the math functions operate component-wise. the description is per-component. so like, each lil lane does its own thing, no cross-talk, no drama π¦
- the built-in math functions are not affected by the prevailing rounding mode in the calling environment, and they always return the same value as they would if called with the round to nearest even rounding mode. so whatever chaos the surrounding environment is on, these stay unbothered. main character energy fr fr
- the built-in math functions take scalar or vector arguments. the generic type name
gentypeis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. for any specific use of these function, the actual type has to be the same for all arguments and the return type β no mixing, bestie, it's a matching set or nothing π€ - if extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{2|3|4|8|16}as arguments and return values. β¨
π SPECIFICATION π
OpenCL Specification[1]
π«Ά SEE ALSO π«Ά
π AUTHORS π
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
- OpenCL Specification β page 244, section 6.12.2 - Math Functions
and that's the whole page bestie, no cap π shoutout to The Khronos Group for writing it and for the 01/14/2021 date stamp β go forth and scale by powers of two, you absolute icon, ily, bye π§πΈ
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms