Refactored hp_from_double() and hp_add_hp() to reduce operation counts.