MAG(3clc)
β¨ 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 backxif| x| > |y|, oryif|y| > |x|, otherwise it's givingfmax(3clc)(x, y). so like, whoever's bigger in magnitude wins, and if they're tied,fmaxcomes in to break it up π«Άminmagβ hands you backxif|x| < |y|, oryif|y| < |x|, otherwise it's givingfmin(3clc)(x, y). same energy but it's rooting for the smaller one, and ties get settled byfminπ
πΈ 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
gentypeis used to indicate that the function can takefloat,float2,float3,float4,float8,float16,double,double2,double3,double4,double8, ordouble16as the type for the arguments. she's flexible like that π - If extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{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
gentypefis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. float-coded only π - The generic type name
gentypedis used to indicate that the function can takedouble,double2,double3,double4,double8, ordouble16as the type for the arguments. double-coded only π
β SPECIFICATION β
OpenCL Specification[1]
π₯ SEE ALSO π₯
π AUTHORS π
The Khronos Group
π COPYRIGHT π
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) π
- 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
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms