Fixed off by one error

- Fixed off by one error for edge pixel extension.
- Switched to double values to increase precision.