You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing np.clip(-0.010945739779012037, -1.0, 1.0) vs glm.clamp(-0.010945739779012037, -1.0, 1.0) and I get -0.010945739779012037, and -0.010945740155875683, when both should just be -0.010945739779012037. This appears to be because glm.clamp is doing a f32 conversion, which it shouldn't be doing.
Looking at the code I see this on line 27487:
PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf(clamp)
Looking at PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf shows:
There's not a single reference to double, so it seems apparent that this macro is not capable of handling double precision code arguments. I'm not sure exactly what this is doing, and it makes it difficult to contribute since it is one giant file, but I assume if everything here is just copied again but with double as the parameter it should just work? All the other similar macros appear to reference double, so presumably anything that uses that macro is going to have this same bug.
The text was updated successfully, but these errors were encountered:
Cazadorro
changed the title
glm.clamp converts to float internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
glm.clamp **always** converts to float internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
Dec 20, 2019
Cazadorro
changed the title
glm.clamp **always** converts to float internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
glm.clamp always converts to float internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
Dec 20, 2019
Cazadorro
changed the title
glm.clamp always converts to float internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
glm.clamp(float64) always converts to float32 internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
Dec 20, 2019
Cazadorro
changed the title
glm.clamp(float64) always converts to float32 internally because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf (I think)
glm.clamp(float64) always converts to float32 internally possibly because of bug in PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf
Dec 20, 2019
Yupp, you are correct. It should support float and double and not float only.
Currently, clamp is the only function using this macro.
Fixing this should be quite simple.
I know how cumbersome it is to deal with this one large file, however, it is not possible to use multiple source files due to the way C++ handles static variables (they are unique for every source file) and the Python C-API requires basically everything to be static.
The macros are already making it easier to solve problems and reduce the likeliness of making new ones.
The only way you could split up the huge file would be into header files and that wouldn't really help either.
I was testing
np.clip(-0.010945739779012037, -1.0, 1.0)
vsglm.clamp(-0.010945739779012037, -1.0, 1.0)
and I get-0.010945739779012037
, and-0.010945740155875683
, when both should just be-0.010945739779012037
. This appears to be because glm.clamp is doing a f32 conversion, which it shouldn't be doing.Looking at the code I see this on line 27487:
Looking at
PyGLM_MAKE_GLM_FUNC_NNN_VVV_VNN__tf
shows:There's not a single reference to
double
, so it seems apparent that this macro is not capable of handling double precision code arguments. I'm not sure exactly what this is doing, and it makes it difficult to contribute since it is one giant file, but I assume if everything here is just copied again but with double as the parameter it should just work? All the other similar macros appear to reference double, so presumably anything that uses that macro is going to have this same bug.The text was updated successfully, but these errors were encountered: