3.74
Solution
This is the solution, with inline asm code in C:
range_t find_range(float x)
{
__asm__(
"vxorps %xmm1, %xmm1, %xmm1\n"
"vucomiss %xmm1, %xmm0\n"
"movl $3, %edx\n"
"movl $2, %ecx\n"
"movl $1, %edi\n"
"movl $0, %esi\n"
"cmova %ecx, %eax\n"
"cmove %edi, %eax\n"
"cmovb %esi, %eax\n"
"cmovp %edx, %eax\n"
);
}
The complete C file, along with checks over all \(2^{32}\) values can be found here.