convert mpf t to double with rounding-modes defined by ieee754

usenett@gmx.de usenett at gmx.de
Fri Jul 29 17:23:35 CEST 2005


Hi,

I want to write a function of converting mpf_t-variables to doubles by a
given rounding mode (to-nearest, truncation, plus infinity, minus infinity)
defined by the IEEE754 standard.

Actually the mpf_get_d-method takes the (max.) two most significand limbs
and adds both to get the double-value. So after getting the first 53
significand bits of the mantissa, a simple truncation takes place. Possibly
existing lower sticky bits are not considered.

Has anyone a good description of an algorithm, how to determine the correct
corresponding double-value from a mpf_t-variable (resp. from a given binary
sequence) for the various rounding-modes? Or has possibly anyone already
done such a work for mpf_t?

Greets,
Heinz

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl


More information about the gmp-discuss mailing list