I think float cannot hold more than 32bit, ur number is definately more than 32bit.
try double its 64bit
and long double i think is 80 bits ? or 82 bits not sure about long double.

Atleast try your program with using double or long double !!
Will save a lot of effort. ;o)




----- Original Message ----- 
From: Vertical rains <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 30, 2002 11:53 AM
Subject: [ilugd]: Trivial C problem (Updated)


> hello everyone
> 
>    i have the following program
> 
>   ///////////////////////////////////
> 
>   #include <stdio.h
>   #include <iostream.h
>   void main ()
>   {
>    float x = 1073741855;
> 
>    printf ("%f\n", x);
>    cout << x;
>   }
> 
>   //////////////////////////////////
> 
>   and the out put on running is as follows
> 
>   1073741824.000000
>   1.07374e+09
> 
>   What i want to know is that why am i not
>   getting  the o/p as 1073741855 .There is a 
> difference
>   of 31.What am i doing wrong?
>         ====for those who posted 
> suggestions====
>     I would not like to change the data type 
> to something   else as the float can 
> definitely hold this value
>     And i also did try declaring the value of 
> x as   float x=1073741855.0; instead of float 
> x=1073741855;
>     Used  the <iostream.h> and <stdio.h> 
> mutually   exclusively so that they do not 
> clash with each other
> 
>   It does'nt help and the o/p is still the 
> same.
> 
>   So somebody please HELLLLLLLLLLPPPPPPPPP
> 
>   Thanks everybody.
>   Regards
>   Virindera
> 
> 
> 
> -- 
> 
> _______________________________________________
> Win a ski trip!
> http://www.nowcode.com/register.asp?affiliate=1net2phone3a
> 
> 
>           ================================================
> To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
> To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject 
>header
> Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
>           =================================================
> 

          ================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
          =================================================

Reply via email to