FMIN(3clc)

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

πŸ’– 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 a NaN ruin the vibe, she just hands you the one that actually works. 🫢
  • if both arguments are NaNs, fmin() returns a NaN. 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:

  • fmin and fmax(3clc) behave as defined by C99 and may not match the IEEE 754-2008 definition for minNum and maxNum with 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 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.
  • 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. πŸŽ€
  • 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.
  • 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.

πŸ”₯ 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 πŸ“

  1. 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