Announcement

Collapse
No announcement yet.

When Zero is not Zero

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • When Zero is not Zero

    From this post.... all the way at the bottom...

    ...even the basics like 0 is not the same as 0&.

  • #2
    Or to put it more clearly. "A float is not an integer"

    A float is not an appropriate value to pass BYVAL to an API function which requires a DWORD or LONG as a parameter.

    In VBA an untyped "0" is cast as a float. "0&" ensures that a LONG is passed to the function.



    Last edited by Stuart McLachlan; 24 Aug 2019, 04:55 AM.

    Comment


    • #3
      Zero as a concept is more complex than you tend to realize.

      It is a number - sure, but it has specific characteristics that no other number has. For instance it is the only number which is not positive or negative!

      The other use for zero is a space holder - so you can tell by its placement how many 10 to the nth power another number is. The ancients had quite an issue with this and this space holder function of zero was one of the major numeric breakthroughs of mathematics and numbering systems.

      When I was a junior programmer (not last week!), we numbered our fields (usually characters - somewhat equivalent to bytes) from zero. So when we referred to a character we could say "address plus count" and if you were referring to the first character - well the system worked. The first character being the zeroth character - ouch. This was combined with the fact that we counted in octal - of course. I realised on day in 1967 that I was using this technique to count real life things. There are 0,1,2 apples on the table - that is 3 apples. OOPS.

      And infinity is the other fun number. In fact infinity is not a number in any circumstance! Not even going to think about Aleph Null.
      [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
      Kerry Farmer

      Comment


      • #4
        Originally posted by Kerry Farmer View Post
        Zero as a concept is more complex than you tend to realize.

        It is a number - sure, but it has specific characteristics that no other number has. For instance it is the only number which is not positive or negative!
        .
        Is it odd or even?

        Comment


        • #5
          Originally posted by Kerry Farmer View Post
          When I was a junior programmer (not last week!), we numbered our fields (usually characters - somewhat equivalent to bytes) from zero. So when we referred to a character we could say "address plus count" and if you were referring to the first character - well the system worked. The first character being the zeroth character - ouch.
          Many still do.
          What is the lower bound of Dim x(10) as long ?
          Zero based arrays are the default in the vast majority of programming environments.
          Any time you use a pointer, the first element you address is ptr+0.

          Comment


          • #6
            Is it odd or even?
            One more than +1 is +2, which is even. One less than -1 is -2, which is even.
            Zero is one away from both +1 and -1, therefore 0 is even. (even (other meaning of "even") though a floating point format binary can be zero whether or not the sign bit is set ((which would put two zeros between +1 and -1)))

            All just IMO of course.

            ((It is also the roundest number character. (only the letter "O" is rounder than "0")))
            Dale

            Comment


            • #7
              Zero is not a number and should not be included in any type of calculations. For example, in Dale's context, he can't add zero to -1 or subtract it from +1 to change the original value. Zero is an imaginary concept, like dark matter, dark energy, and dreams.
              Zero has value, oxymoron notwithstanding, only as a place holder to keep us from confusing ourselves and others.
              You can't multiply anything by zero because if you have zero to multiply with you have nothing. You can't divide anything by zero because you don't have anything to divide with. Division by zero is the same thing as not dividing so why should it be undefined?
              You should never start counting at zero or you'll be two fenceposts out.
              Finished ranting.
              Rod
              "To every unsung hero in the universe
              To those who roam the skies and those who roam the earth
              To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

              Comment


              • #8
                Originally posted by Stuart McLachlan View Post
                Is it odd or even?
                or Prime????
                [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                Kerry Farmer

                Comment


                • #9
                  Interesting Rod. I disagree that it can't be in a calculation. It can certainly be a result. That means it can be part of the next calculation.

                  3 - 1 = 2, 2 - 1 = 1, 1 - 1 = 0, 0 - 1 = -1, -1 - 1 = -2 How do you get from 1 to -1? (Simplest, smallest example I could think of.)

                  How did changing the value become a requirement?

                  (Zero as place holder in multidigit numbers is a more important concept (IMO).)

                  The definition of prime I use precludes 0 and 1 from being prime. Perhaps interesting; 2 is the only even prime.

                  Infinity next? That's full of contadictions.

                  Cheers,
                  Dale

                  Comment


                  • #10
                    Negative numbers don't exist in the real world, except as a concept. I have spent hours explaining to customers that just because the entered the wrong number to sell in their inventory control system, and drove the on-hands to a negative value, the automatic ordering would only order new product as if it was a zero. Some seemed to think that they had a void that would suck up any new parts ordered, i.e. if you had a -5 on-hand you would have to order 10 to get back to 5 on hand. This was when they were converting from an index fcard based inventory system and were switching to the pos system we installed. The mechanics would use any part that would fit and use the correct part number on the invoice. Fun times.

                    Comment


                    • #11
                      Then positive numbers don't exist either. The thing being measured, or items being counted, are in the real world, but the numbers (positive) are a concept too. ((IMO))
                      Dale

                      Comment


                      • #12
                        Originally posted by Rodney Hicks View Post
                        Zero is not a number and should not be included in any type of calculations. For example, in Dale's context, he can't add zero to -1 or subtract it from +1 to change the original value. Zero is an imaginary concept, like dark matter, dark energy, and dreams.
                        Zero has value, oxymoron notwithstanding, only as a place holder to keep us from confusing ourselves and others.
                        You can't multiply anything by zero because if you have zero to multiply with you have nothing. You can't divide anything by zero because you don't have anything to divide with. Division by zero is the same thing as not dividing so why should it be undefined?
                        You should never start counting at zero or you'll be two fenceposts out.
                        Finished ranting.
                        I, Wolfram and every mathematician I am aware of would disagree with you.

                        http://mathworld.wolfram.com/Zero.html

                        You can certainly add a number to 0 and "change its value". It's the whole basis of real numbers.
                        0+1 = 1


                        Also
                        2^0 = 1
                        0! = 1
                        0/2 = 0

                        Comment


                        • #13
                          Originally posted by Kerry Farmer View Post

                          or Prime????
                          No, because it has lots of divisors (an infinite number of them in fact)

                          Comment


                          • #14
                            Originally posted by keith shelton View Post
                            Negative numbers don't exist in the real world, except as a concept. I have spent hours explaining to customers that just because the entered the wrong number to sell in their inventory control system, and drove the on-hands to a negative value, the automatic ordering would only order new product as if it was a zero. Some seemed to think that they had a void that would suck up any new parts ordered, i.e. if you had a -5 on-hand you would have to order 10 to get back to 5 on hand. This was when they were converting from an index fcard based inventory system and were switching to the pos system we installed. The mechanics would use any part that would fit and use the correct part number on the invoice. Fun times.
                            A negative number is perfectly valid in an inventory system when you include commitments rather than just physical inventory.
                            And in that context you had better order 10 if your normal holding is 5 and you have -5 including commitments to unfilled orders.

                            Comment


                            • #15
                              You can certainly add a number to 0 and "change its value". It's the whole basis of real numbers.
                              0+1 = 1
                              And did zero change the value of one. 0+1 is the same as 1+0 and one is one either way. 0 does not change the value of any other number by adding or subtracting. "change its value' was not in my post. If you really think that we can change the value of one by adding zero to it then....well, I'm sorry.
                              Also
                              2^0 = 1
                              0! = 1
                              0/2 = 0
                              It seems to me that somewhere along the way, I've read that the first two of these were deemed to be standards without proofs because they yield acceptable results, or something like that. The third makes perfect sense, since I didn't get it twice and I still don't get it.

                              Zero used as a number should be 0 and used as a place holder should be 0.
                              Rod
                              "To every unsung hero in the universe
                              To those who roam the skies and those who roam the earth
                              To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

                              Comment


                              • #16
                                0 does not change the value of any other number ...
                                Again, where is the requirement that the value change? Okay if that is your definition, it's just not mine.

                                Cheers,
                                Dale

                                Comment


                                • #17
                                  Because numbers, by adding, subtracting, etc the values change, at least with all digits 1 - 9. They struggled for years without a placeholder. The first person to call zero a number should have been drawn and quartered, burned at the stake, or at least fed zero every day!
                                  Rod
                                  "To every unsung hero in the universe
                                  To those who roam the skies and those who roam the earth
                                  To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

                                  Comment


                                  • #18
                                    The least significant position also needs a placeholder. My mind has not changed. So we have different opinions.

                                    Cheers,
                                    Dale

                                    Comment


                                    • #19
                                      I was thinking

                                      Zero as a place holder is not the only number convention which is not 1,2,3,4 etc

                                      A decimal point (period, full stop) is also a place holder.

                                      A comma can be a 'visual' place holder and in some countries can also be used as I would use a decimal point.

                                      A minus sign has meaning - obviously. And in a number it is not usually a hyphen - except in telephone numbers!! We also use a hyphen/minus sign to indicate range eg there are 10- 20 horses in that paddock.

                                      We also use zeroes to denote significant figures. If I say there is 1,500,000 people I mean there are that many people give or take a few 100 thousand depending on context. But if I say 1,592,321 people, I mean just that.

                                      And I can define my expected error range by saying +/- ie there were 100 dogs +/- 10 means between 90 and 110 dogs but not more or less.

                                      The order of the numbers has meaning 123 does not equal 321!

                                      A superscripted number means 'raised to the power of' although we computer people use a ^ because of limitations in the computerised font system and because we like text to be inline text

                                      A subscripted number usually means 'to the base of' and can be used for defining the counting base eg 10, but sometimes we want to say 8 or 16 or even 60 if we are ancient Babylonians. It is also used to set the base of a logarithmic number and is usually 10 but mathematicians use 'e' and there is no reason not to use other bases.

                                      We sometimes use brackets but that is mostly for what I will call 'text numbers' for phone numbers.

                                      We use extended numbering system for hex or duodecimal systems eg 0123456789ABCDEFG (hex)

                                      We use ~ to mean approximately

                                      We use M for millions and B for Billions especially for money (I have never seen T for trillions!)

                                      We use $ signs and € and pound and yen signs in numbers too (and others roubles, rupees etc). These are part of the number and not quite units as such

                                      Sometimes the currency signs are qualified for the country eg $US100, $NZ200

                                      What else?

                                      Interesting discussion

                                      Kerry


                                      [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                                      Kerry Farmer

                                      Comment


                                      • #20
                                        If 0 is not a number, then what is 1° below 1°F ?

                                        Comment

                                        Working...
                                        X