LOG(3clc)
β¨ LOG, LOG2, LOG10, LO β the OpenCL Manual π
okay bestie, gather round, because we're about to talk about logarithms and honestly? it's giving math class but make it cute. this is a page from the OpenCL Manual (that's the 3clc manual, iykyk) and it's literally all about the log family. periodt. π
πΈ NAME πΈ
log, _log2, _log10, _log1p, _logb β Logarithm functions. yes, the whole girl group is here. π
the signatures go a lil something like this, and you're gonna want to copy these exactly, no cap:
gentype log(gentype );
gentype log2(gentype );
gentype log10(gentype );
gentype log1p(gentype x);
gentype logb(gentype x);
gentype half_log(gentype x);
gentype half_log2(gentype x);
gentype half_log10(gentype x);
gentype native_log(gentype x);
gentype native_log2(gentype x);
gentype native_log10(gentype x);
π¦ DESCRIPTION π¦
so here's the tea on what each one actually does β
logβ computes natural logarithm. the og. the main character. πΏlog2β computes a base 2 logarithm. for when your brain thinks in powers of two. π»log10β computes a base 10 logarithm. for when your brain thinks in powers of ten. π’log1pβ computesloge(1.0 + x). yes theeis lowercase, no we do not make the rules. β¨logbβ computes the exponent ofx, which is the integral part oflogr |x|. slay. πhalf_logβ computes natural logarithm. (the half-precision cousin has arrived π§)half_log2β computes a base 2 logarithm. πhalf_log10β computes a base 10 logarithm. πnative_logβ computes natural logarithm over an implementation-defined range. the maximum error is also implementation-defined. πnative_log2β computes a base 2 logarithm over an implementation-defined range. maximum error: implementation-defined. πnative_log10β computes a base 10 logarithm over an implementation-defined range. maximum error: implementation-defined. π
π NOTES π
okay this is the part where you actually pay attention, bestie, because these are the deets that'll save you later. fr fr.
- the vector versions of the math functions operate component-wise. the description is per-component. so like, each lil lane does its own thing. π«
- 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. consistency queen. π
- the built-in math functions take scalar or vector arguments. for any specific use of these functions, the actual type has to be the same for all arguments and the return type, unless otherwise specified. no mixing, bestie, it's not that kind of party. π«
- the generic type name
gentypeis used to indicate that the function can takefloat,float2,float3,float4,float8,float16,double,double2,double3,double4,double8, ordouble16as the type for the arguments. a whole wardrobe. π - if extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{2|3|4|8|16}as arguments and return values. β¨ - the generic type name
gentypefis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. - the generic type name
gentypedis used to indicate that the function can takedouble,double2,double3,double4,double8, ordouble16as the type for the arguments. - functions with the
half_prefix are implemented with a minimum of 10-bits of accuracy i.e. an ULP value less than or equal to8192 ulp. so like, precise-ish. she's trying her best. π - functions with the
native__prefix may map to one or more native device instructions and will typically have better performance compared to the corresponding functions (without thenative__prefix). the accuracy (and in some cases the input range(s)) of these functions is implementation-defined. so yeah, fast, but she's mysterious about the details. π₯
π SPECIFICATION π
OpenCL Specification[1] β that's where the receipts live, go look. π«Ά
π SEE ALSO π
mathFunctions(3clc)β the whole math girlies squad. go say hi. π
π AUTHORS π
The Khronos Group. iconic. no notes. β
π 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.
(translation: free to use, just keep the receipt attached. slay. π )
π NOTES (the footnote one, not the other one) π
OpenCL Specificationβ page244, section6.12.2 - Math Functions. there it is, the source material. πΈ
and that's the whole page, bestie!! this was the LOG, LOG2, LOG10, LO(3clc) page from the OpenCL Manual, brought to you by The Khronos Group, dated 01/14/2021. log off and go take a nap, you earned it. πβ¨π¦
π¦ 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