FMIN(3clc)
π FMIN(3clc) π
okay so bestie, we're in the OpenCL Manual today and we're talking about fmin β the girl whose whole job is picking the smaller one. no drama, no debate, she just looks at two numbers and goes "yeah that one's less." icon behavior honestly. β¨
πΈ NAME πΈ
fmin β returns the lessor of either x or y.
β¨ SYNOPSIS β¨
gentype fmin(gentype x, gentype y);
gentypef fmin(gentypef x, float y);
gentyped fmin(gentyped x, double y);
gentype fmin (gentype x, half y)
// if half extension enabled
π¦ DESCRIPTION π¦
She returns y if y is less than x, otherwise she returns x. that's it, that's the whole job.
now the messy part, and you KNOW there's always a messy part:
- if one argument is a
NaN,fmin()returns the other argument. she's not gonna let aNaNruin the vibe, she just hands you the one that actually works. π«Ά - if both arguments are
NaNs,fmin()returns aNaN. sometimes there's just no saving it bestie π
π NOTES π
okay this section is the one where the spec girlies get real with you, so let's go:
fminandfmax(3clc)behave as defined by C99 and may not match the IEEE 754-2008 definition forminNumandmaxNumwith regard to signaling NaNs. specifically, signaling NaNs may behave as quiet NaNs. so don't come for her about IEEE, she's on her C99 era. π- the vector versions of the math functions operate component-wise. the description is per-component. so like, each lil lane does its own thing, no gossiping between lanes.
- 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. so whatever your environment's rounding mood is that day? she does not care. unbothered. unshaken. π§
- 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. matchy matchy only, no mixing. π
- 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. - if extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{2|3|4|8|16}as arguments and return values. π - the generic type name
gentypefis used to indicate that the function can takefloat,float2,float3,float4,float8, orfloat16as the type for the arguments. - the generic type name
gentypedis used to indicate that the function can takedouble,double2,double3,double4,double8, ordouble16as the type for the arguments.
π₯ 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 π
- OpenCL Specification β page 244, section 6.12.2 - Math Functions
and that's the whole page bestie, no cap. this absolute gem came to you courtesy of The Khronos Group, dated 01/14/2021 β go forth and pick the smaller number, fr fr. πβ¨π¦
π¦ 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