TRUNC(3clc)
π TRUNC β the trunc(3clc) page, but make it cute π
okay so bestie, welcome to the OpenCL Manual entry for trunc(3clc). It's short, it's sweet, it's giving "I round things toward zero and I'm not sorry about it." Let's get into it. π
β¨ NAME β¨
trunc β Round to integer toward zero.
gentype trunc(gentype );
fr fr, that's the whole signature. Note the lil space before the ) β we're keeping it exactly as the manual has it, no editing the icon's fit. π
πΈ DESCRIPTION πΈ
Round to integral value using the round to zero rounding mode.
That's it. That's the whole job. It takes your number, yeets it to the nearest whole number in the direction of zero, and does not care about your feelings about halves. π
π¦ NOTES π¦
Okay this is the part where the manual gets chatty, so let's go through it together:
- 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. Main character energy for every component. π
- 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.
this is important!! Do NOT expect your ambient rounding mode to change what these functions spit out. They're immune. They said "not today." π
- 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, no matching, no chaos. π«Ά
- 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. - If extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{2|3|4|8|16}as arguments and return values. - The generic type name
gentypefis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. - The generic type name
gentypedis used to indicate that the function can takedouble,double2,double3,double4,double8, ordouble16as the type for the arguments.
π SPECIFICATION π
OpenCL Specification[1] β yeah, the whole thing is spec'd, go look it up, it's iconic.
π SEE ALSO π
π«Ά 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 following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
(yes bestie the license text stays verbatim, legal girlies don't play π)
π NOTES (the footnote one) π
- OpenCL Specification β page 244, section 6.12.2 - Math Functions
and that's the whole page!! go forth and truncate responsibly, my love π§ mwah β¨
This has been TRUNC(3clc) from the OpenCL Manual, brought to you by The Khronos Group, dated 01/14/2021. mwah, bye bestie ππΈ
π¦ 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