POW(3clc)

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

✨ POW, POWN, POWR, HAL(3clc) ✨

okay bestie, welcome to the OpenCL Manual β€” today we're doing exponent math and honestly? it's giving ✨ power ✨ (literally). pull up a chair, we're gonna go through every single one of these functions, no skips, no skimming, periodt. πŸ’…


🌸 NAME 🌸

pow, _pown, _powr, _half_powr, _native_powr β€” Compute x to the power of y.

and here's the whole squad in their exact fits, no cap:

gentype pow(gentype x, gentype y);

floatn pown(floatn x, intn y);

float pown(float x, int y);

doublen pown(doublen x, intn y);

double pown(double x, int y);

gentype powr(gentype x, gentype y);

gentype half_powr(gentype x, gentype y);

gentype native_powr(gentype x, gentype y);

halfn pown(halfn x, intn y);

half pown(half x, int y);

like. look at them. iconic lineup fr fr 🫢


πŸŽ€ DESCRIPTION πŸŽ€

  • pow β€” Computes x to the power of y. the classic. the moment. πŸ‘‘
  • pown β€” Computes x to the power of y, where y is an integer. y said "I'm built different" and locked in as an int. πŸ”’
  • powr β€” Computes x to the power of y, where x is β‰₯ 0. so like, keep x non-negative bestie, it's the vibe check of this function. ✨
  • half_powr β€” Computes x to the power of y, where x is β‰₯ 0. same energy, half precision edition πŸŽ€
  • native_powr β€” Computes x to the power of y, where x is β‰₯ 0. heads up though: the range of x and y are implementation-defined, and the maximum error is implementation-defined too. so like, it's fast but it's mysterious. πŸ’€

πŸ’– NOTES πŸ’–

okay this is the part where I tell you the important lore, don't skip it:

  • The vector versions of the math functions operate component-wise. The description is per-component. so each lil component does its own thing, independently, living its own life πŸ¦‹
  • 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. they do not care what the environment is doing. unbothered. thriving. πŸ’…
  • 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. so no mixing, bestie, the fit has to match head to toe πŸ‘‘
  • 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. that's the whole roster. 🌈
  • 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. 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. float-only club ⭐
  • 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. double-only club, precision girlies only πŸ’œ
  • Functions with the half_ prefix are implemented with a minimum of 10-bits of accuracy i.e. an ULP value less than or equal to 8192 ulp. yes that is a lot of ulp. it is what it is πŸ“
  • Functions with the native__ prefix may map to one or more native device instructions and will typically have better performance compared to the corresponding functions (without the native__ prefix). The accuracy (and in some cases the input range(s)) of these functions is implementation-defined. so: faster, yes, but it's on the implementation to decide how accurate, and sometimes even how much input it'll accept. no promises, only vibes 🫢
not me writing "implementation-defined" three separate times because it keeps coming up 😭 it's coming up A LOT okay

πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ‘€ SEE ALSO πŸ‘€

mathFunctions(3clc)


🫢 AUTHORS 🫢

The Khronos Group


Copyright Β© 2007-2010 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!! this edition of the OpenCL Manual was brought to you by The Khronos Group, dated 01/14/2021, and it's titled POW, POWN, POWR, HAL(3clc) β€” go forth and exponentiate responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from