FRACT(3clc)

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

πŸ’– FRACT(3clc) β€” the OpenCL Manual, bestie edition πŸ’–

okay so you opened the fract page from the OpenCL Manual and you're like "what is this tiny function doing" β€” bestie, it's giving fractional value, and I'm about to make you obsessed with it. πŸ¦‹


✨ NAME ✨

fract β€” Fractional value in x. that's it, that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

three flavors, pick your memory space, they all slap:

gentype fract(gentype x, __global gentype *itpr);
gentype fract(gentype x, __local gentype *itpr);
gentype fract(gentype x, __private gentype *itpr);

πŸ’… DESCRIPTION πŸ’…

so it returns this, literally character for character:

fmin(3clc)( x - floor(3clc)(x), 0x1.fffffep-1f )

and floor(3clc)(x) gets handed back to you through iptr. cute, right? she does the work and she tells you what she did. main character energy fr fr. πŸ‘‘


πŸŽ€ NOTES πŸŽ€

okay the tea on that min() operator: it's there specifically so that fract(-small) doesn't come back at you with 1.0. rude of it, honestly. so instead it returns the largest positive floating-point number that's still less than 1.0. no cap. ✨

the vector versions of the math functions operate component-wise, and the description is per-component. so like, each lane minds its own business. 🧚

the built-in math functions are not affected by the prevailing rounding mode in the calling environment β€” they always return the same value as they would if they were called with the round to nearest even rounding mode. periodt.

the built-in math functions take scalar or vector arguments. for any specific use of these functions, the actual type has to be the same for all arguments and the return type, unless otherwise specified. don't mix and match, babe, it's not that kind of party. πŸ™ˆ

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. look at her range. πŸ’œ

if extended 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. half girlies rise. 🌈

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] β€” go read it, it's right there. πŸ“–


🫢 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 244, section 6.12.2 - Math Functions. πŸ“š

okay bestie, that's the whole page, every flag, every type, every word, nothing skipped, nothing invented, and you're welcome. πŸ’…

signing off with love from The Khronos Group, dated 01/14/2021, on the FRACT(3clc) page itself. slay, ate, no crumbs. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from