LOG(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

✨ 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 β€” computes loge(1.0 + x). yes the e is lowercase, no we do not make the rules. ✨
  • logb β€” computes the exponent of x, which is the integral part of logr |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 gentype is used to indicate that the function can take float, float2, float3, float4, float8, float16, double, double2, double3, double4, double8, or double16 as the type for the arguments. a whole wardrobe. πŸ‘—
  • if extended with cl_khr_fp16(3clc), generic type name gentype may indicate half and half{2|3|4|8|16} as arguments and return values. ✨
  • the generic type name gentypef is used to indicate that the function can take float, float2, float3, float4, float8, or float16 as the type for the arguments.
  • the generic type name gentyped is used to indicate that the function can take double, double2, double3, double4, double8, or double16 as 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 to 8192 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 the native__ 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 πŸ‘€


πŸ’œ AUTHORS πŸ’œ

The Khronos Group. iconic. no notes. ⭐


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) πŸ“

  1. OpenCL Specification β€” page 244, section 6.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