If the only issue is the test, we can use the stackoverflow version:

```
    int shift = CHAR_BIT*sizeof i - 1;
    int m = i%n;
    return m+ (m>>shift & n);
```

But it requires the shift and the binary and...

But the numpy expr can contains either float or integer right?