# Simple GLSL Error

This topic is 3497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Simple error, hopefully simple solution. The test code is as follows:
abs(float(4)); //This line works
float(abs(4)); //This line does not

The specific error I'm getting is: error C1101: ambiguous overloaded function reference "abs" <stdlib>(605) : ps fixed absfixed(fixed) <stdlib>(604) : ps half abshalf(half) Ideas? Thanks, -G

##### Share on other sites
Just write abs(4.0) so that the function returns a float.

##### Share on other sites
In the code, the "4" would be replaced by a variable. I reduced it down to this code just to see why switching the order of the functions makes a difference?
-G

##### Share on other sites
because the conversion from int to either half or fixed are neither worse or better than the other. So, when you write abs(4); it sees the two conversions, can't decide between the two, and fails to compile with an ambiguous overload error.

However, in the case of using abs(float(4)), you convert 4 to a float, which calls abs() with a float argument, instead of attempting to convert.

##### Share on other sites
Thank you, that makes sense.
What are "half" and "fixed"?

• 48
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631374
• Total Posts
2999661
×