Miscellaneous > Programming & Networking

A little C help

(1/2) > >>

Fett101:
Doing this thing to calculate the number of seconds since a given year using int and then float. They're both giving me different numbers.


--- Code: ---
--- End code ---

Gives 31536000 like it should.


--- Code: ---
--- End code ---

gives me 13184.

Perhaps it's just the data type limitation, but I coulda sworn int's could hold larger numbers...

Fett101:
NM. Is the data type. Thanks for coming. Have a safe drive home.

Paladin9:
Nice

flap:
Actually either should work. The maximum value of a 32 bit integer is about 2 billion.

Fett101:
I changed it to a long an it works fine now.

Navigation

[0] Message Index

[#] Next page

Go to full version