This is an important floating point math routine, documented in many places. Example code utilizing the routine: - https://www.lemon64.com/forum/viewtopic.php?t=67576&sid=d41e77cdddd28d6f9c9d52ce5b4e8dc3