On Thu, Sep 12, 2013 at 9:36 PM, emailstorbala <emailstorbala@xxxxxxxxx> wrote: > > I have an issue in printing a large number in a c program. Please find below > the code snippet : > > /#include <math.h> > > int main() > { > double temp = 0.0; > > temp = pow(2, 2000); > > printf("The value of temp is %lf\n", temp); > > return 0; > } > / > I compiled and ran as below: > > [balamurugan@balamurugan C_Programs]$ gcc test.c -o test > [balamurugan@balamurugan C_Programs]$ ./test > The value of temp is inf > > But for the same expression, I am able to get the value from python, > > [balamurugan@balamurugan C_Programs]$ python > Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) > [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> pow(2,2000) > 114813069527425452423283320117768198402231770208869520047764273682576626139237031385665948631650626991844596463898746277344711896086305533142593135616665318539129989145312280000688779148240044871428926990063486244781615463646388363947317026040466353970904996558162398808944629605623311649536164221970332681344168908984458505602379484807914058900934776500429002716706625830522008132236281291761267883317206598995396418127021779858404042159853183251540889433902091920554957783589672039160081957216630582755380425583726015528348786419432054508915275783882625175435528800822842770817965453762184851149029376L >>>> > > I know that in gcc, there is an option for getting this done. Can any body > help me with that option? You are incorrect. There is no GCC option that will help you here. Python and C are two different languages and they represent numbers in different ways. To do this kind of thing in C you will need to use some sort of bignum library, such as libmpfr. Ian