FREXP(3clc)

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

πŸ’– FREXP(3clc) πŸ’–

okay bestie, gather round, because we're doing frexp from the OpenCL Manual and honestly? it's giving math but make it fashion ✨


🌸 NAME 🌸

frexp β€” extract mantissa and exponent, no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

like, there are eighteen of these and every single one is iconic, so buckle up:

floatn frexp(floatn x, __global intn *exp);

floatn frexp(floatn x, __local intn *exp);

floatn frexp(floatn x, __private intn *exp);

float frexp(float x, __global int *exp);

float frexp(float x, __local int *exp);

float frexp(float x, __private int *exp);

doublen frexp(doublen x, __global intn *exp);

doublen frexp(doublen x, __local intn *exp);

doublen frexp(doublen x, __private intn *exp);

double frexp(double x, __global int *exp);

double frexp(double x, __local int *exp);

double frexp(double x, __private int *exp);

halfn frexp(halfn x, __global intn *exp);

halfn frexp(halfn x, __local intn *exp);

halfn frexp(halfn x, __private intn *exp);

half frexp(half x, __global int *exp);

half frexp(half x, __local int *exp);

half frexp(half x, __private int *exp);

eighteen overloads. eighteen. the range? unmatched. 🫢


✨ DESCRIPTION ✨

So what are we doing here? We're pulling the mantissa and the exponent out of x, bestie. That's the whole vibe.

For each component, the mantissa you get back is a float with magnitude sitting pretty in the interval [1/2, 1) β€” or it's 0, that's also allowed, she contains multitudes πŸ’–

And the glow-up equation? Every component of x equals the mantissa you got back * 2exp. That's it. That's the math. iconic 🌈


πŸ¦‹ NOTES πŸ¦‹

  • The built-in math functions are not affected by whatever rounding mode is vibing in the calling environment, and they always return the same value as they would if they'd been called with the round to nearest even rounding mode. periodt. πŸ’…
  • An application that wants to use the half and halfn types is gonna need to include the #pragma OPENCL EXTENSION cl_khr_fp16(3clc) : enable directive. no directive, no halfs, that's the rule πŸŽ€

⭐ SPECIFICATION ⭐

OpenCL Specification[1] πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group β€” the actual main characters, honestly 🌟


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 following condition: the above copyright notice and this 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 ✨

lowkey a whole saga for one little function, but she earned it πŸ’…

and that's the tea, bestie 🧚 this page is from the OpenCL Manual, dated 01/14/2021, brought to you by The Khronos Group β€” and yes, the name up top was FREXP(3clc) the whole time πŸ˜­πŸ’– stay slay, stay floating-point βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from