FMA(3G)
β¨ FMA β the fused multiply-add bestie β¨
Okay so this is fma, and it lives in section 3G of the manual (that's the OpenGL shading language corner of the docs, iykyk). It does one thing and it does it beautifully: it multiplies two numbers and adds a third, all in one go. π¦
π NAME π
fma β perform a fused multiply-add operation. That's it, that's the whole vibe. π
πΈ DECLARATION πΈ
Here's the signature, and bestie, you're gonna want to copy this exactly:
genType fma(genType a, genType b, genType c);
genDType fma(genDType a, genDType b, genDType c);
Two flavors, one for the regular floats (genType) and one for the double-precision girlies (genDType). Both are icons. π
π PARAMETERS π
aβ the first multiplicand, aka the first number getting multiplied. She's part of the main character energy of the multiplication. β¨bβ the second multiplicand. Her partner in crime in the multiplication. π«Άcβ the value that gets added onto the result. The little sprinkle on top. π
π DESCRIPTION π
So fma performs, where possible, a fused multiply-add operation, and it returns:
a * b + c
But here's the part that actually matters, the part where it gets interesting. There are use cases where the return value eventually gets consumed by a variable declared as precise. And when that happens:
fma()is considered a single operation, whereas the expressiona * b + cconsumed by a variable declared aspreciseis considered two operations. Two!! Different count entirely. π- The precision of
fma()can differ from the precision of the expressiona * b + c. Like, not even the same number of bits of accuracy, potentially. fma()will be computed with the same precision as any otherfma()consumed by aprecisevariable, which gives you invariant results for the same input values ofa,bandc. Consistent. Reliable. Slay. β¨
Otherwise β meaning in the absense of precise consumption (yes, that's how it's spelled in the original, and I'm keeping it fr fr) β there are no special constraints on the number of operations, or on any difference in precision betweenfma()and the expressiona * b + c. So outside of thatprecisesituation, don't assume anything extra. No cap. π
π VERSION SUPPORT π
Here's the vibe check on which OpenGL Shading Language versions support this function. β means she's there, - means she has not arrived yet. The columns are, in order: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50.
fma(genType) β1.10:-,1.20:-,1.30:-,1.40:-,1.50:-,3.30:-,4.00:β,4.10:β,4.20:β,4.30:β,4.40:β,4.50:βfma(genDType) β1.10:-,1.20:-,1.30:-,1.40:-,1.50:-,3.30:-,4.00:β,4.10:β,4.20:β,4.30:β,4.40:β,4.50:β
So basically both versions showed up in 4.00 and have been serving looks ever since. Anything before that? Ghost town. π«₯ Before 4.00, it's giving nothing. But from 4.00 onward? Every single one. Ate. π
β COPYRIGHT β
Copyright Β© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group
And that's the whole page, bestie β mwah. π This one came out of the [FIXME: source] build, dated 01/03/2018, filed under FMA(3G). Go forth and fused-multiply-add responsibly. π¦β¨
π¦ where this page comes from
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms