- Local time
- Today, 11:57
- Joined
- Feb 28, 2001
- Messages
- 28,741
datAdrenaline, I think I would reverify the reference date for Excel vs. Windows. Since Excel uses the system clock to "do its thing" the two should be the same.
If SQL server and JET use different numbers, ... I wish I could say I'm surprised. My Alphas running OpenVMS use 17 Nov 1868 as day 0. (It's called "Smithsonian" time.) A rose by any other name would smell as sweet.
Regarding the different tests and whether something was compared to zero or not, it isn't QUITE as simplistic as that. In the final analysis, for a cast, you are very right, they are all compared to zero and it is either zero (FALSE) or not zero (TRUE). BUT the problem is ... WHICH BIT is compared to zero? If it ain't "packed" then you need to know the language's definition of a Boolean. Which is why I made all that hoo-raw about the different instructions.
Is it that the sign bit is the one that counts? Then you use the instructions for less/greater - and the other bits don't count.
Is the least significant bit that counts? Then you use the tests for odd/even.
Is it the whole byte? Then you could use a test for zero/not zero.
BUT the language specification tells you how the test works. Not the hardware. The only thing the hardware does for you is make it easier or harder to implement the language. In Ada, for example, you can look this up under the ANSI standard specification for data representation. FORTRAN, BASIC, Pascal, C, ... each has its standard. And it is OK for them to be different.
Now, Banana, you commented above about knowing when one of those little "casts" occurs. Well, actually it is easy in VBA under Access. "Option Explicit" will tell you when you are about to create a new variable. Then all that is left is to examine anything that involves a known cast variable.
Take that case where you did CDBL(1/24) instead of CDBL(1)/CDBL(24). If that was actually supposed to be a time, that failure to correctly pre-cast the time cost you 33 seconds (roughly), which is the point at which 1/24 as a SINGLE truncates a date/time number for contemporary dates. That is a quick-and-dirty approximation so don't hold my feet to the fire if you think I'm off by a couple of seconds.
If SQL server and JET use different numbers, ... I wish I could say I'm surprised. My Alphas running OpenVMS use 17 Nov 1868 as day 0. (It's called "Smithsonian" time.) A rose by any other name would smell as sweet.
Regarding the different tests and whether something was compared to zero or not, it isn't QUITE as simplistic as that. In the final analysis, for a cast, you are very right, they are all compared to zero and it is either zero (FALSE) or not zero (TRUE). BUT the problem is ... WHICH BIT is compared to zero? If it ain't "packed" then you need to know the language's definition of a Boolean. Which is why I made all that hoo-raw about the different instructions.
Is it that the sign bit is the one that counts? Then you use the instructions for less/greater - and the other bits don't count.
Is the least significant bit that counts? Then you use the tests for odd/even.
Is it the whole byte? Then you could use a test for zero/not zero.
BUT the language specification tells you how the test works. Not the hardware. The only thing the hardware does for you is make it easier or harder to implement the language. In Ada, for example, you can look this up under the ANSI standard specification for data representation. FORTRAN, BASIC, Pascal, C, ... each has its standard. And it is OK for them to be different.
Now, Banana, you commented above about knowing when one of those little "casts" occurs. Well, actually it is easy in VBA under Access. "Option Explicit" will tell you when you are about to create a new variable. Then all that is left is to examine anything that involves a known cast variable.
Take that case where you did CDBL(1/24) instead of CDBL(1)/CDBL(24). If that was actually supposed to be a time, that failure to correctly pre-cast the time cost you 33 seconds (roughly), which is the point at which 1/24 as a SINGLE truncates a date/time number for contemporary dates. That is a quick-and-dirty approximation so don't hold my feet to the fire if you think I'm off by a couple of seconds.