Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in assigning 15 digit numner - pl help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi ,

I am encountering a queer problem in a c program.

main()
{
double fld1;
fld1=2299595420;
Prinf("\n passed field value is %.0f ");
}

It gives an output of value -1995371876. However i want to see the actual value of 299595420.
This works fine if i cange the value to either 129959520 or increase the value to more than 10 digits. I found that it fails to give the assined value only when there are 10 digits with the starting digit as 2.

Can any of you please help as i am using this in a c routine. I have tried using 10.0f etc.

Thanks in advance

Jags
 
The following works on my machine:

[tt]
#include<stdio.h>
main()
{
double fld1;
fld1=229959542012345;
printf(&quot;\n passed field value is %.0lf &quot;, fld1);
}
[/tt]

Maybe you have forgotten to pass fld1 to the function printf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top