SIGN(3clc)

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

✨ SIGN(3clc) β€” the OpenCL Manual's lil sign-checker ✨

okay bestie, welcome to SIGN(3clc) from the OpenCL Manual, this is genuinely one of the cutest functions in the whole common functions lineup, let's get into it πŸ’–


🌸 NAME 🌸

sign β€” it gives you the sign of a value. that's it. that's the whole job. she's focused, she's simple, she's iconic πŸ‘‘

gentype sign(gentype x);

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea, here's exactly what she returns:

  • 1.0 if x > 0
  • -0.0 if x = -0.0
  • +0.0 if x = +0.0
  • -1.0 if x < 0
  • 0.0 if x is a NaN

like the way she can tell apart -0.0 and +0.0?? that's the attention to detail, that's the main character energy, nobody else is doing it fr fr 😭✨


🧚 NOTES 🧚

so the generic type name gentype is used to say "hey this function can take any of these as the type for the arguments":

float, float2, float3, float4, float8, float16, double, double2, double3, double4, double8, or double16

then there's gentypef, which means the function can take:

float, float2, float3, float4, float8, or float16

as the type for the arguments.

and gentyped means the function can take:

double, double2, double3, double4, double8, or double16

as the type for the arguments.

also important bestie:</p紫色> the built-in common functions are implemented using the round to nearest even rounding mode. no cap. 🫢

and if you extend 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. so yes she got that half precision glow-up too 🌈


πŸ“œ 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 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 260, section 6.12.4 - Common Functions

okay that's the whole page bestie, go forth and check your signs, mwah πŸ’–

β€” brought to you by The Khronos Group, dated 01/14/2021, and this was SIGN(3clc) signing off πŸ¦‹βœ¨

πŸ“¦ where this page comes from