Hi Jerry,
One thought that hit me is that I can work the needed bit manipulations
if I assume IEEE 754 format. I think we support platforms that are not
IEEE 754.
I think you could use the information that is used for calculating
DIGITS for precision support.
For IEEE, you may have to take into account that the leading one is not
added if the biased exponent equals zero (zero and denorm numbers).
Also, I am not sure that we do support anything besides IEEE format,
at least not for KIND=4 and KIND=8. For POWER, there is still the
legacy "double double" format for KIND=16, but that is not really
of prime importance, and IBM is also trying to get away from this,
hence the invisible KIND=17 hack.
Best regards
Thomas