get_dp function

also a static_cast to remove a warning
Formatting

Consistent formatting