Fast, Vectorizable method of taking floating point number modulus of special primes?

Posted by caffiend on Stack Overflow See other posts from Stack Overflow or by caffiend
Published on 2010-03-16T19:58:13Z Indexed on 2010/03/16 20:01 UTC
Read the original article Hit count: 232

Is there a fast method for taking the modulus of a floating point number?

With integers, there are tricks for Mersenne primes, so that its possible to calculate y = x MOD 2^31 without needing division.

Can any similar tricks be applied for floating point numbers?
Preferably, in a way that can be converted into vector/SIMD operations, or moved into GPGPU code.

The primes I'm interested in would be 2^7 and 2^31, although if there are more efficient ones for floating point numbers, those would be welcome.

© Stack Overflow or respective owner

Related posts about floating-point

Related posts about simd