Open gottfriedleibniz opened 7 months ago
glm_vec4_round without SSE41 (e.g., -DGLM_FORCE_SSE2 -DGLM_FORCE_DEFAULT_ALIGNED_GENTYPES) does not properly handle values outside of +/-2^23 (i.e., no fractional part in the float).
-DGLM_FORCE_SSE2 -DGLM_FORCE_DEFAULT_ALIGNED_GENTYPES
For example:
#include <glm/glm.hpp> #include <glm/gtx/string_cast.hpp> #include <iostream> int main(void) { glm::vec4 v(8388609.f, 8428605.f, 9988605.f, 10388605.f); std::cout << "Expected: " << glm::to_string(v) << std::endl; std::cout << "Actual: " << glm::to_string(glm::floor(v)) << std::endl; return 0; } // └> g++ -O3 -march=native -I${GLM_PATH} -DGLM_FORCE_SSE2 -DGLM_FORCE_DEFAULT_ALIGNED_GENTYPES round.cpp // └> ./a.out // Expected: vec4(8388609.000000, 8428605.000000, 9988605.000000, 10388605.000000) // Actual: vec4(8388608.000000, 8428604.000000, 9988604.000000, 10388604.000000) // └> g++ -O3 -march=native -I${GLM_PATH} -DGLM_FORCE_AVX2 -DGLM_FORCE_DEFAULT_ALIGNED_GENTYPES round.cpp // └> ./a.out // Expected: vec4(8388609.000000, 8428605.000000, 9988605.000000, 10388605.000000) // Actual: vec4(8388609.000000, 8428605.000000, 9988605.000000, 10388605.000000)
glm_vec4_round without SSE41 (e.g.,
-DGLM_FORCE_SSE2 -DGLM_FORCE_DEFAULT_ALIGNED_GENTYPES
) does not properly handle values outside of +/-2^23 (i.e., no fractional part in the float).For example: