Converting rationals, long double and integers

edA-qa mort-ora-y eda-qa at disemia.com
Tue Mar 12 19:28:09 CET 2013


I see a function "mpq_get_d", but is there also a function to convert to
a "long double"? I notice in the todo list a possible mpf_get_ld, but it
isn't available yet. Is there some other way I can convert a
rational/float to a long double without losing precision?

Is there a function to convert a rational directly to an integer with
truncating the fraction part? Is it enough to do "q.get_num() /
q.get_den()" ? In particular, will that always round towards zero?

-- 
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://gmplib.org/list-archives/gmp-discuss/attachments/20130312/074bc05d/attachment.bin>


More information about the gmp-discuss mailing list