FABS(3clc)
π FABS β aka the fabs page from the OpenCL Manual β¨
okay bestie, sit down, hydrate, because we're talking about fabs from the OpenCL Manual and it's honestly so much cuter than it sounds π
πΈ NAME πΈ
fabs β computes the absolute value of a floating-point number. that's it. that's the whole job. iconic behavior fr fr π
gentype fabs(gentype );
β¨ DESCRIPTION β¨
fabs computes the absolute value of a floating-point number. like, if your number is negative, it comes back positive. glow-up arc, no cap π¦
π§ NOTES π§
okay so here's the tea, and it's important tea β
- The vector versions of the math functions operate component-wise. The description is per-component. so like, each lane does its own lil thing, independently, slay π«
- 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. so no matter what chaos your environment is in, these functions keep it consistent. stable 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 and matching, bestie, we're not doing that here π
- 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. that's a whole roster and every single one of them is valid π - If extended with
cl_khr_fp16(3clc), the generic type namegentypemay indicatehalfandhalf{2|3|4|8|16}as arguments and return values. yes, half types get to come to the party too π - The generic type name
gentypefis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. float-only club πΈ - The generic type name
gentypedis used to indicate that the function can takedouble,double2,double3,double4,double8, ordouble16as the type for the arguments. double-only club π
π SPECIFICATION π
OpenCL Specification[1] β go read it, it's giving authoritative β¨
π SEE ALSO π
mathFunctions(3clc)β the whole math functions family, your new hyperfixation fr fr π«Ά
π AUTHORS π
The Khronos Group. yes, THE Khronos Group. main character energy, honestly π
π 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: it's free, use it, just keep the notice in there. respect the og π)
π NOTES (the numbered one, not the other one, yes there are two, don't @ me) π
- OpenCL Specification β page 244, section 6.12.2 - Math Functions. that's your page number, bestie, memorize it πβ¨
and that's the whole page!! π
<cute sign-off time> this lil masterpiece was brought to you by The Khronos Group, dated 01/14/2021, and it lives in the FABS(3clc) section of the OpenCL manual. stan a stable API. 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