Extract fractional part of double *efficiently* in C
问题 I'm looking to take an IEEE double and remove any integer part of it in the most efficient manner possible. I want 1035 ->0 1045.23->0.23 253e-23=253e-23 I do not care about properly handling denormals, infinities, or NaNs. I do not mind bit twiddling, as I know I am working with IEEE doubles, so it should work across machines. Branchless code would be much preferred. My first thought is (in pseudo code) char exp=d.exponent; (set the last bit of the exponent to 1) d<<=exp*(exp>0); (& mask the