COS(3clc)

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

πŸ’– COS(3clc) β€” the OpenCL Manual, but make it make sense πŸ’–

okay bestie, sit down, hydrate, because we're talking about the cosine functions from the OpenCL manual and honestly? they're giving trig legend energy. 🌈 this is COS(3clc), straight outta the OpenCL Manual, and yes we're doing all of it. no skips. periodt.


✨ NAME ✨

cos, _cosh, _cospi, _half_cos, _native_cos β€” Cosine functions. πŸ¦‹

gentype cos(gentype );

gentype cosh(gentype );

gentype cospi(gentype x);

gentype half_cos(gentype x);

gentype native_cos(gentype x);

🌸 DESCRIPTION 🌸

so here's the lineup, bestie, and every single one of them is serving:

  • cos β€” it's the cosine function. that's it, that's the vibe. πŸ‘‘
  • cosh β€” the hyperbolic cosine function. she's got range (literally, hyperbolically). πŸ’…
  • cospi β€” computes cos (x * pi). yes, she multiplies by pi for you. iconic behavior. ✨
  • half_cos β€” computes cosine. but listen: x must be in the range -216... +216. and she's implemented with a minimum of 10-bits of accuracy, i.e. an ULP value less than or equal to 8192 ulp. so like... she's cute but she's not your precision queen, and we respect her for that. πŸŽ€
  • native_cos β€” computes cosine over an implementation-defined range. the maximum error is also implementation-defined. no cap.
🫢 real talk about the native__ prefix, because this matters: 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 trade-off? the accuracy (and in some cases the input range(s)) of these functions is implementation-defined. so she's fast, she's fun, she's a little unpredictable. main character energy fr fr. πŸ’€

πŸŽ€ NOTES πŸŽ€

okay this is the part everyone skips and then everyone regrets skipping, so let's go:

  • the vector versions of the math functions operate component-wise. the description is per-component. 🧚
  • the built-in math functions are not affected by the prevailing rounding mode in the calling environment, and always return the same value as they would if called with the round to nearest even rounding mode. consistent 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. πŸ™ˆ
  • 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. 🌸
  • 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. ⭐

πŸ‘‘ SPECIFICATION πŸ‘‘

OpenCL Specification[1]

(yeah, footnote one. we'll get there. patience, bestie. πŸ“)


πŸ¦‹ SEE ALSO πŸ¦‹

go read her next, she's the whole friend group. πŸ’…


🌈 AUTHORS 🌈

The Khronos Group β€” the collective. the council. the ones who decided all of this. 🫢


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 following conditions:

the condition is that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. that's the whole deal. keep the receipt. 🧾


⭐ NOTES (the footnote one, not the other one) ⭐

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

and that's the whole page, bestie!! πŸŽ‰ every flag, every range, every ULP, every gentype variant, all of it, accounted for. no details were harmed in the making of this manpage.

this was The Khronos Group, dated 01/14/2021, and the page is COS(3clc). mwah. πŸ’‹ go compute some cosines. slay. πŸ’…βœ¨
πŸ“¦ where this page comes from