Implement writeDouble