SIN(3clc)
πΈ SIN, SINCOS, SINH, SINPI, HALF_SIN, NATIVE_SIN β the OpenCL Manual page π
okay bestie, sit down, hydrate, because we're doing trigonometry today and honestly? it's giving iconic. this is the sin family page from the OpenCL Manual, and every single one of these babies is a sine function. periodt. β¨
π NAME π
sin, _sincos, _sinh, _sinpi, _half_sin, _native_sin β Sine functions. π
and here's the whole squad in their natural habitat, verbatim, no edits, no cap:
gentype sin(gentype );
gentype sincos(gentype x, __global gentype *cosval);
gentype sincos(gentype x, __local gentype *cosval);
gentype sincos(gentype x, __private gentype *cosval);
gentype sinh(gentype );
gentype sinpi(gentype x);
gentype half_sin(gentype x);
gentype native_sin(gentype x);
β¨ DESCRIPTION β¨
okay so, function by function, let's get into it:
sinβ computes the sine. that's it, that's the whole vibe. π¦sincosβ computes sine AND cosine ofx, because why do one when you can do both? the computed sine is the return value, and the computed cosine gets handed back to you throughcosval. two for one, slay. πsinhβ computes the hyperbolic sine. fancy cousin behavior. πsinpiβ computessin (pi * x). yes, pi is baked in, you don't gotta bring your own. π₯§half_sinβ computes sine, but heads up bestie:xmust be in the range-216... +216. that's the rule, don't test it. πnative_sinβ computes sine over an implementation-defined range, and the maximum error is also implementation-defined. so like... your device decides. mysterious. π₯
π NOTES π
- the vector versions of the math functions operate component-wise. the description is per-component, so think of it as the same little party happening in every lane. π
- built-in math functions are NOT affected by the prevailing rounding mode of the calling environment, and they always return the same value as they would if called with the round to nearest even rounding mode. consistent queen. π
- 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 a vibe check. β
- the generic type name
gentypemeans the function can takefloat,float2,float3,float4,float8,float16,double,double2,double3,double4,double8, ordouble16as the type for the arguments. - if extended with
cl_khr_fp16(3clc), the generic type namegentypemay also indicatehalfandhalf{2|3|4|8|16}as arguments and return values. π§ - the generic type name
gentypefmeans the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. - the generic type name
gentypedmeans 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β€ 8192 ulp. that's the fine print, fr fr. π - 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). but the accuracy (and in some cases the input range(s)) of these functions is implementation-defined. so: faster, but mysterious. choose wisely. π₯
π SPECIFICATION π
OpenCL Specification[1]
π«Ά SEE ALSO π«Ά
mathFunctions(3clc) β go read your sibling page, bestie, it's the whole family tree. π³
π 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 (yes, a second NOTES section, we love a plot twist) π
- OpenCL Specification β page 244, section 6.12.2 - Math Functions
okay that's the whole page, you ate it, I'm obsessed. π this was SIN, SINCOS, SINH, S(3clc) from the OpenCL Manual, brought to you by The Khronos Group, dated 01/14/2021. go forth and compute your sines, my main character. periodt. πβ¨ππ¦πΈπ
π«Ά
π¦ 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