GMP rounding algorithm

LiuEmma yanjiyun2002 at hotmail.com
Wed Apr 1 06:21:31 CEST 2009


Hi,

 

I have a question about the rounding algorithm of GMP.

 

This is part of my code:

 

mpf_t f;

char* pchStr = "99999999985";

mpf_init_set_str (f,pchStr,10);
char *ch = mpf_get_str(NULL,&exp,10,10,f);

 

 

The reuslt is supposed to be

ch = "9999999999"

 

but actually it is "9999999998"

 

Would anybody tell me why and which rounding algorithm the gmp lib uses?

 

Regards,

Emma

_________________________________________________________________
梦幻K图,百变造型,让你的照片与众不同,快来MClub试试吧!
http://club.msn.cn/?form=3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gmplib.org/list-archives/gmp-discuss/attachments/20090401/ebb0a5bf/attachment.html>


More information about the gmp-discuss mailing list