TRUNC(3clc)

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

πŸ’– 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 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, the whole thing is spec'd, go look it up, it's iconic.


πŸ‘€ SEE ALSO πŸ‘€


🫢 AUTHORS 🫢

The Khronos Group


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) πŸ’…

  1. 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