It can be the other way around as well if you enumerate them.Quote:
Originally Posted by dsheller
Printable View
It can be the other way around as well if you enumerate them.Quote:
Originally Posted by dsheller
So how would one express this in significant form?
2x0^2?
:D
Easy.
2x0^2
:afrog:
I guess it would be called insignificant form.
You're an insignificant form.
Leading digits are critically important in binary. I'll limit this to a signed byte for simplicity...
2 == 00000010
-2 == 11111110
In the latter, the leading ones don't literally mean 1 they are purely to indicate the negative property of the number. To convert this to human-sensible "-2" one has to do a bitwise not and then add one.
after bitwise not: 00000001 (positive 1)
after adding one 00000010 (positive 2)
Then, since you knew it was a negative number to begin with, you just stick a "-" on the front to give you "-2".
So you see in binary processing at least, leading digits are vitally important. Modern processors do this because it enables them to use the exact same circuits to perform mathematical operations on a number whether it is positive or negative without having to handle each case separately.
We should limit here with NATURAL NUMBERS (N-set, non-negative integers) only. For Z-set (including negative numbers) probably we should have another thread.
002 is the amount of liters of coffee I drink in a day. :afrog:
Redefine the argument until you win it once and for all! Good plan. :DQuote:
Originally Posted by anhn
No, we should limit it to the value types held by the .NET programming langauge. Nothing else matters in the discussion.Quote:
Originally Posted by anhn
No. If you were using an integer, you never had 4 bits to begin with. You had 64 bits. The first 60 were zeros and the last 4 were 1010.Quote:
Originally Posted by dsheller
Ok, let's expand on this a bit. Suppose we had:Quote:
Originally Posted by dsheller
Dim stick, stone1 as integer
Dim stone2 as string
stick = 2
stone1 = 002
stone2 = "Blue"
Now, it would be entirely possible to convert stick or stone1 into strings, but they would convert to strings. Similarly, you could cast stick to a long, a short, or even a byte, and it should also be obvious that you couldn't do the same with stone2, because it isn't a number of any sort. However, it may not be obvious that you also can't cast stone1 to any other type.
Do you know why that is?
overflow.
I my world zero is the absence of sugar.
You are right and because of that you are wrong. What gets stored on the stack isQuote:
Originally Posted by Tom Sawyer
00000000000000000000000000000010
I am awfully sure that the computer doesn't care what you think about leading zero's, it does.
On second thought it is both and neither.
2 <----- Is just some pixels on my screen. When my brain(is it AM/PM) interprets it, it is TWO. My brain knows that it is a number, but it might be a bad drawing of the Cobra insignia on my buddies mustang. If I am trying to program or make Tom S angry then
Dim TomS As String, two As Int32 = 2
TomS = "00000" & two.ToString : two = Int32.Parse(TomS) + 0
Debug.WriteLine(TomS)
Debug.WriteLine(two)
Those aren't leading zeros. They're bits. The two concepts are completely different.Quote:
Originally Posted by dbasnett
Is 0 base2 = 0 baseAnything?
I don't know what base2 is. Could you provide code?Quote:
Originally Posted by dbasnett
AKA Binary
0 or 1 in reference to a bit refers NOT to a value, but to a state. Take the following bit stack, for example:
0000 0000 0000 0000
There are NO ZERO'S in that stack. Even if the final representation is that of a zero, there are no zero's. They simply mean "off". You can't use bits to try to explain it because bits have no concept of number OR string, merely state.
This is getting more esoteric all the time. Nobody even answered my very reasonable question.
I'll agree from the perspective of the bit, and electrically, that is a correct statement. It is off or on. But...Quote:
Originally Posted by timeshifter
When I first started programming (late 60's) we were taught that a bit is
on = 1 = true
or
off = 0 = false
I've programmed a lot of machines in a lot of languages, including a lot of different assemblers, and I don't remember one instruction that referenced on / off. In all fairness Dr. Knuth's MIX computer did have jump instructions that referenced toggles being on or off. My experience with assemblers, as I recall, said transfer of control would happen if condition was true.
And I still haven't seen a computer language that talked about bit math like this
on + on = off
But I am old and dated.
I give, why?Quote:
Originally Posted by Shaggy Hiker
Lol!
clearly it is not possible to turn any number into a non number with the addition of one or many leading zeros.
the next issue is what data type can hold a number input by a programmer with leading zeros without causing an error with visual basic, and there are at least 3 different options including variant, string and numerical data types.
so what is the most efficient solution? well a variant is a very large and cumbersome datatype and therefore would not be the most efficeint choice. a string due to the lack of mathematical operations required of it seems to be one option if the number merely needs to be stored for display purposes, however, a numeric datatype would be the most likely option and if the development language is written properly also the most efficient especially for base 2-10 numbers, as there is more overhead in a datatype required to be able to store every character rather than just numbers in memory. Although if a numeric string datatype was available then perhaps it would be the most efficient for storing and retrieving numbers for display purposes only.
in this case the number is 002, and if we assume the number is going to be used for integer calculations only, then the most efficient datatype is not a variant or a string but an integer, or long integer depending on the size of the calculations expected.
Cause only he who is without sin can cast the first stone....and it ain't anyone here!Quote:
Originally Posted by dbasnett
:lol: rofl :lol:Quote:
Originally Posted by Shaggy Hiker
I think any arguments or hatreds started by this thread were worth it just to see that.
You are all wrong, they are all of the above and beyond.
002 is a number with leading zeroes and zeroes still count as a number.
"002" is a string with padded zeroes and zeroes also counts as a string.
002 will be 010 if it is converted to bytes.
002 will be 02 if it is converted to hex.
It doesn't matter what the compiler thinks. It has no brain.
Har! Har! I win.
Noobz!!!! :lol:
:lol: :rofl:Quote:
Originally Posted by Shaggy Hiker
I mentioned this with my discussion with penagate last night... my example doesn't necessarily have to be taken in context with computing. Regardless, why would I have 64 bits? I'm fairly certain I'm using 32 bit integers over here. =)Quote:
Originally Posted by Tom Sawyer
stick is a Variant, so it's a ******* data type already, but yes I get your argument, and I'm going to exit this discussion with the following opinion:Quote:
Originally Posted by Shaggy Hiker
If it is a symbol that can be easily recognized as representing a quantity of objects (that's all numbers are really for anyway) then I say it's a number. Since I am sentient and can realize that 002 is a numerical representation it's a number, to me.
Technically speaking, if a symbol represents a quantity of objects, it's actually an alphanumeric character. :afrog:
I hope this will clarify a bit regarding the issue:
http://en.wikipedia.org/wiki/String_...ter_science%29
http://en.wikipedia.org/wiki/Integer...ter_science%29
http://en.wikipedia.org/wiki/Integer
Greg
Stick and stone1 can break my code, but variable names will never hurt me?Quote:
Originally Posted by Shaggy Hiker
:lol:Quote:
Originally Posted by mendhak
if you fill in a document, and i don't mean on a computer, that requires you to put in data, such as a date, anything with a value less than ten is expected to have a leading zero.Quote:
Originally Posted by MaximilianMayrhofer
example: fill out my taxes, it asks for my birth month. i enter 07.
07/28/1973.
anyone who's taken accounting will also see leading zeros an awful lot. It's also used when writing a check with less than ten cents in the change spot. 07/100 for example. As this wikipedia link shows, it's also used in most digital displays of numbers, such as stopwatches or clocks.
As for programming tricks,
it obviously is a number because it's got a value greater than zero. If you want it treated like a string, you will have to enclose it in quotes.Code:a = 002
msgbox a
As for binary 00000010, the fact is that the fact it's 8 bits long shouldn't matter. Base 2 doesn't require leading zeros any more than base 10 does, or base 16. &Hff = &h0000ff, (green).
Dates are not numbers.
The number resolves to 2 in any circumstance. In any mathematical operation 002 is considered to be 2. You can perform multiple operations with 002 and any other number and still get the same output as if you were using 2.
In most programming languages, you will find that 002 will always be resolved to 2. If a number needs to be padded with 0s, it would need to be a string.
not in computers, but they are in the real world.Quote:
Originally Posted by penagate
The 28th day of the 7th month in the 2008th year of our lord...
Actually that's not true either. They are numbers in computers as well. They are stored as a double(?) that is equal to the number of days since an arbitrary date that represents the beginning of the system calendar. Using the "date" datatype is a direct way of having the OS display this double(?) as a STRING. But you can't deny that the individual parts (year, month, day) are all numbers.