ATAN(3clc)

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

✨ ATAN(3clc) ✨

the OpenCL Manual β€” trig edition, but make it ✨angles✨

okay so bestie, you wanna do some tangent math in your kernel? say less. this whole page is about the atan family and honestly? it's giving trigonometry but cute. let's get into it πŸ’…


🌸 NAME 🌸

atan,_atan2,_atanh,_atanpi,_atan2pi β€” tangent functions πŸŽ€

and here's what they actually look like when you call them, verbatim:

gentype atan(gentype y_over_x);

gentype atan2(gentype y, gentype x);

gentype atanh(gentype );

gentype atanpi(gentype x);

gentype atan2pi(gentype y, gentype x);

(yes, atanh's parameter is unnamed in the spec. iconic of them. not my problem πŸ’€)


πŸ¦‹ DESCRIPTION πŸ¦‹

  • atan β€” it's the arc tangent function. classic.
  • atan2 β€” the arc tangent of y / x. two arguments, one vibe.
  • atanh β€” the hyperbolic arc tangent function.
  • atanpi β€” computes atan (x) / Ο€. that's right, it already divided by pi for you, no cap πŸ₯§
  • atan2pi β€” computes atan2 (y, x) / Ο€. same deal, pi included, you're welcome.

πŸ’œ NOTES πŸ’œ

okay now the ✨fine print✨, but I promise it's important, bestie:

  • the vector versions of the math functions operate component-wise. the description is per-component. so like, every lane gets the same treatment, no favorites πŸ’…
  • the built-in math functions are not affected by the prevailing rounding mode in the calling environment. they always return the same value as they would if called with the round to nearest even rounding mode. so whatever your environment is doing, these stay consistent. periodt.
  • 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 means the function can take float, float2, float3, float4, float8, float16, double, double2, double3, double4, double8, or double16 as the type for the arguments. that's the whole roster 🌈
  • if extended with cl_khr_fp16(3clc), the generic type name gentype may indicate half and half{2|3|4|8|16} as arguments and return values. half precision girlies, we see you 🧚
  • the generic type name gentypef means the function can take float, float2, float3, float4, float8, or float16 as the type for the arguments. floats only, no doubles allowed πŸ“
  • the generic type name gentyped means the function can take double, double2, double3, double4, double8, or double16 as the type for the arguments. doubles only, that's the whole personality πŸ’œ

⭐ SPECIFICATION ⭐

OpenCL Specification[1] β€” yes, that's the one. go read it, iykyk πŸ“–


πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group πŸ’– (the ones who made all of this happen, respectfully)


Copyright Β© 2007-2011 The Khronos Group Inc.

and now the legal bit, verbatim because we do NOT paraphrase lawyers, bestie:

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 πŸ’€

(yes there's a second NOTES section, don't @ me, that's just how the page is structured)

  1. OpenCL Specification page 244, section 6.12.2 - Math Functions

lowkey the most important thing here: these are component-wise and rounding-mode-proof. the built-ins don't care what your environment is doing. they're booked, busy, and consistent. πŸ’…

and that's the whole page!! 🌈✨ this was brought to you by The Khronos Group, dated 01/14/2021, and yes we are still obsessed with it. go forth and compute your angles, bestie, you're gonna slay πŸ«ΆπŸ’–

πŸ“¦ where this page comes from