MAG(3clc)

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

✨ MAXMAG, MINMAG β€” the OpenCL Manual, bestie edition ✨

okay so you're in the <cyan>OpenCL</cyan> manual, section 3clc, and today we're decoding maxmag and minmag β€” the two functions that pick a winner based on vibes… no wait, based on magnitude. same thing basically πŸ’…


πŸ’– NAME πŸ’–

maxmag, _minmag β€” returns the argument with the greatest (or least) magnitude.


πŸŽ€ SYNOPSIS πŸŽ€

gentype maxmag(gentype x, gentype y);

gentype minmag(gentype x, gentype y);

πŸ¦‹ DESCRIPTION πŸ¦‹

  • maxmag β€” hands you back x if | x| > |y|, or y if |y| > |x|, otherwise it's giving fmax(3clc)(x, y). so like, whoever's bigger in magnitude wins, and if they're tied, fmax comes in to break it up 🫢
  • minmag β€” hands you back x if |x| < |y|, or y if |y| < |x|, otherwise it's giving fmin(3clc)(x, y). same energy but it's rooting for the smaller one, and ties get settled by fmin 😌

🌸 NOTES 🌸

okay this is the part where I need you to actually lock in, bestie 🧚

  • The vector versions of the math functions operate component-wise. The description is per-component. so like, each lane does its own thing, no cross-talk, no drama ✨
  • The built-in math functions are not affected by the prevailing rounding mode in the calling environment, and always return the same value as they would if called with the round to nearest even rounding mode. no cap β€” the ambient rounding mode does not get a vote here πŸ’€
  • The built-in math functions take scalar or vector arguments. For any specific use of these function, the actual type has to be the same for all arguments and the return type unless otherwise specified. match your types or it's not it πŸ™ˆ
  • 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. she's flexible like that πŸ‘‘
  • 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. halfs are invited to the party, but only if that extension says so πŸŽ€
  • 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. float-coded only πŸ’™
  • 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. double-coded only πŸ’œ

⭐ SPECIFICATION ⭐

OpenCL Specification[1]


πŸ”₯ SEE ALSO πŸ”₯

mathFunctions(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 (the reference one, not the other one) 🌈

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

and that's the whole page, babe πŸ’… this one's brought to you by The Khronos Group, dated 01/14/2021, filed under MAXMAG, MINMAG(3clc). go forth and compare magnitudes responsibly 🫢✨

πŸ“¦ where this page comes from