fix incorrect mod rounding

`mod` currently gives some incorrect values when it should be exact, e.g.:
```julia
julia> mod(prevfloat(1.0),1.0)
0.0

julia> rem(prevfloat(1.0),1.0)
0.9999999999999999
```
This should fix those problems. I've also tried to improve the documentation of the related functions.