Fastest precise way to convert a vector of integers into floats between 0 and 1
问题 Consider a randomly generated __m256i vector. Is there a faster precise way to convert them into __m256 vector of floats between 0 (inclusively) and 1 (exclusively) than division by float(1ull<<32) ? Here's what I have tried so far, where iRand is the input and ans is the output: const __m256 fRand = _mm256_cvtepi32_ps(iRand); const __m256 normalized = _mm256_div_ps(fRand, _mm256_set1_ps(float(1ull<<32))); const __m256 ans = _mm256_add_ps(normalized, _mm256_set1_ps(0.5f)); 回答1: The version