This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reg: gcc option for printing large number (large double)


On Thu, 2013-09-12 at 21:36 -0700, emailstorbala wrote:
> Hi,

> I know that in gcc, there is an option for getting this done. Can any body
> help me with that option?
> 
> Thanks and Regards,
> Balamurugan R
> 
> 

I would suggest you have a look at the Gnu MP library, which deals with
big integers, floats and gives you lots of things that you can normally
find in languages like Python, Go or Java.

An example would be:
    mpz_t a;
    mpz_init(a);
    mpz_set_str(a, "10000000000000000000000000000", 10);
    gmp_printf("%Zd", a);
    mpz_clear(a);
which will print this number back to you, and %Zx will print the Hex
version of it.

-- 
Xinyun Zhou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]