y ^ 0 = y?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce

    #1

    y ^ 0 = y?

    I'm writing a web application in c#, and noticed that any number
    raised to the 0th power results in the number being returned... Am I
    right in that y ^ 0 = 1????

    Is this a bug?

    Bruce
  • 100

    #2
    Re: y ^ 0 = y?

    Hi Bruce,

    In c# operation ^ is bitwise XOR not power operation
    So yes *any nuber* XORed with 0 is the number itself.
    C# as many other languages doesn't have operation for powers of number.

    HTH
    B\rgds
    100


    "Bruce" <btenison@bells outh.net> wrote in message
    news:89bf8c9d.0 311031219.747e4 54f@posting.goo gle.com...[color=blue]
    > I'm writing a web application in c#, and noticed that any number
    > raised to the 0th power results in the number being returned... Am I
    > right in that y ^ 0 = 1????
    >
    > Is this a bug?
    >
    > Bruce[/color]


    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: y ^ 0 = y?

      Bruce,
      To raise a number to a power, you need to use System.Math.Pow . Watch the
      order of the parameters, its easy to get them backwards ;-)

      As 100 pointed out ^ is the Xor operator in C#.

      Hope this helps
      Jay

      "Bruce" <btenison@bells outh.net> wrote in message
      news:89bf8c9d.0 311031219.747e4 54f@posting.goo gle.com...[color=blue]
      > I'm writing a web application in c#, and noticed that any number
      > raised to the 0th power results in the number being returned... Am I
      > right in that y ^ 0 = 1????
      >
      > Is this a bug?
      >
      > Bruce[/color]


      Comment

      • Bruce Tenison

        #4
        Re: y ^ 0 = y?

        Doh! That's what I get for switching languages! Thanks for the help!!

        Bruce

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • ozbear

          #5
          Re: y ^ 0 = y?

          On Mon, 03 Nov 2003 15:46:28 -0800, Bruce Tenison
          <btenison@bells outh.net> wrote:
          [color=blue]
          >Doh! That's what I get for switching languages! Thanks for the help!!
          >[/color]

          Uhhh....errrr.. .which language we you coming from?
          The ^ operator does the same thing (XOR) in C.
          In Delphi it is a pointer declarator/dereferencer.

          Just curious.

          Oz

          Comment

          • Dmitry Baibakov

            #6
            Re: y ^ 0 = y?

            ozbear wrote:
            [color=blue]
            > On Mon, 03 Nov 2003 15:46:28 -0800, Bruce Tenison
            > <btenison@bells outh.net> wrote:
            >
            >[color=green]
            >>Doh! That's what I get for switching languages! Thanks for the help!!
            >>[/color]
            >
            >
            > Uhhh....errrr.. .which language we you coming from?
            > The ^ operator does the same thing (XOR) in C.
            > In Delphi it is a pointer declarator/dereferencer.
            >
            > Just curious.
            >
            > Oz
            >[/color]

            it's VB, don't you remember there is such language? :)))

            Comment

            • Bruce Tenison

              #7
              Re: y ^ 0 = y?

              Yep. That would be it (vb), or actually a lot of vbscript lately, then
              back to c#.

              Bruce



              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              Working...