FDIM(3clc)

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

πŸ’– fdim β€” the OpenCL Manual, bestie edition πŸ’–

okay so you opened fdim(3clc) from the OpenCL Manual and you're like "what is this tiny lil function" β€” bestie it's SO simple and SO useful, let's go 🫢


✨ NAME ✨

fdim β€” the positive difference between x and y. that's it. that's the whole vibe. πŸ’…

gentype fdim(gentype x, gentype y);

🌸 DESCRIPTION 🌸

okay so here's the tea β˜• fdim computes x - y if x is greater than y. and if x is less than or equal to y? it gives you +0. no negatives, no drama, just zero. it's giving "clamp at the floor" energy fr fr ✨


πŸ¦‹ NOTES πŸ¦‹

  • The vector versions of the math functions operate component-wise. The description is per-component. so every lane does its own lil thing independently πŸŽ€
  • 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. consistent queen behavior πŸ‘‘
  • 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, sorry babe πŸ’€
  • 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. that's a LOT of options and honestly? slay 🌈
  • If extended with cl_khr_fp16(3clc), the generic type name gentype may indicate half and half{2|3|4|8|16} as arguments and return values. tiny floats, big energy 🧚
  • 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. floats only, periodt πŸ’…
  • 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. doubles only, also periodt πŸ’œ
not me listing every single generic type name because the manpage said so and we do NOT skip parts here 😀

πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ‘€ 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 condition:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.

like yes bestie, you can use it, just keep the notice in there okay? don't be that person πŸ™ˆ

πŸŽ€ NOTES πŸŽ€

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

and that's the whole page, bestie!! πŸ₯³ shoutout to The Khronos Group, this page is from 01/14/2021 β€” go forth and compute your positive differences, you absolute main character πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from