ISEQUAL(3clc)

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

✨ NAME ✨

isequal β€” the vibe check where we ask "is x literally equal to y?" πŸ’…

Manual page from the OpenCL Manual, bestie. Here's every single flavor it comes in:

int isequal(float x, float y);

intn isequal(floatn x, floatn y);

int isequal(double x, double y);

longn isequal(doublen x, doublen y);

int isequal (half x, half y)   // if
half extension enabled
shortn isequal (halfn x, halfn y)   //
if half extension enabled

πŸ¦‹ DESCRIPTION πŸ¦‹

Returns the component-wise compare of x == y. That's it, that's the whole tea. Every lane does its own little comparison, no cross-talk, no drama. 🫢


πŸ’… NOTES πŸ’…

Okay so if an implementation extends this spec to support IEEE-754 flags or exceptions, then all built-in relational functions shall proceed without raising the invalid floating-point exception when one or more of the operands are NaNs. So like, NaN shows up and everyone just... keeps it moving. No exceptions raised, no meltdown. 😌

The built-in relational functions are extended with cl_khr_fp16(3clc) to include the appropriate versions of functions that take half, and half{2|3|4|8|16} as arguments and return values. Half-precision girlies, you're included. πŸŽ€

Here's the scoring system, and it's giving scalar vs vector energy:

  • Scalar argument types: returns a 0 if the specified relation is false, and a 1 if the specified relation is true.
  • Vector argument types: returns a 0 if the specified relation is false, and a -1 (i.e. all bits set) if the specified relation is true.
Not me realizing the vector version returns all-bits-set instead of a humble little 1. That's the iconic choice and honestly? Respect. πŸ‘‘

And the NaN rule, which applies to the whole friend group:

The relational functions isequal, isgreater, isgreaterequal, isless, islessequal, and islessgreater always return 0 if either argument is not a number (NaN). Meanwhile isnotequal returns 1 if one or both arguments are not a number (NaN) and the argument type is scalar, and returns -1 if one or both arguments are not a number (NaN) and the argument type is vector. So isnotequal is out here switching up its return value based on the argument type. Main character behavior fr fr. πŸ’€


🌈 SPECIFICATION 🌈

OpenCL Specification[1]


πŸ”₯ SEE ALSO πŸ”₯

relationalFunctions(3clc)


πŸ‘‘ 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.


πŸ“š NOTES πŸ“š

  1. OpenCL Specification page 264, section 6.12.6 - Relational Functions

And that's the whole page, bestie β€” brought to you by The Khronos Group, dated 01/14/2021, manual section 3clc. Go forth and compare responsibly. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from