Use utility functions instead of casting to float64 and back