![]() |
Quote:
|
Quote:
Never thought I'd be debating number precision :p One thing that puzzles me though, does the timestamp really have to be signed? How often do we need to store dates from Fri Dec 13, 1901 ;) |
Quote:
if you go to the computer representation, you can see each language uses it's own values and restrictions for the datatypes. in SQL INT is th 32 Bit integer, as it is in php as well. in C if you use INT it means 16 Bit, but actually you can use long int to get 32 Bit (in the old C compileres the int was needed after the long, just newer ones accept long alone as the shortform of long int :)) but, right, i never thought i would discuss about such things ^^ as for the signed question. MySQL allows unsigned int as well, but in php's date function you'll get an error if you try to translate an unsigned int into a timestamp (just tested ;)) @Dark: *gg* |
Quote:
as for the signed question, I should have been a little more clear...it was why is the unix timestamp signed (which is what php goes off of) not why we store it as signed :) |
Nope, int is just the type, but doesn't say anything about the length :)
in SQL INT is 32 Bit, in C++ it's 16 Bit, i believe Java uses nearly the same as C. But as said, it depends on the programming language, the type int itself doesn't have a length (integer in haskell for example is a large as your memory size is ^^) iirc those restrictions come from the first computers, where 16 Bit were long enough for everything, but as said int actually just means full numbers, no length, that's something added by coding languages. well, why should we store it as unsigned, as it's not needed. actually i cannot answer that question really, they decided once to store it signed, and that was it ;) |
When a language says it supports a 32bit integer, it just means it's compiler is able to juggle the 32bit integer to make it work on the current architecure. It doesn't mean it's stored as a 32bit int in memory, just that it's able to juggle it to make it act like a 32bit int. Or like in haskell to give you the feel of a virtually unlimited size int. I think haskell will even use harddisk storage to store the int if it's larger than main memory.
Though, I agree...numbers don't have a finite length, just in computers they do because the hardware is finite :) Anyways, I think we're both arguing the same side of the argument just from different angles :p |
Yes, we are both on the same argument. I just say, what you understand as integer depends on the base you are looking at it.
if you just have 8 bits, then an integer can just be 8 bit long ;) But the term integer doesn't say anything about length at all, just about the type of a value stored at it ;) |
exactly, case solved ;)
hmm... so what was the initial question of this thread? :p |
*gg*
i think the initial question was answered long time ago, was it? ^^ |
0_o wat was the debate about.
i guess modin was right. |
All times are GMT. The time now is 11:46 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|