Problems with mod

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

    Problems with mod

    I'm using Microsoft Visual C++ 6.0. I've been having trouble with my %
    operator in my code; it doesn't seem to be working correctly. As a test I
    typed the following in the Visual Studio quick watch window: "3400 % 1515".
    This evaluated to 0x000009d6 (2518 in decimal). 2518 being larger then
    1515, this is not only an inaccurate, but invalid result! Has anyone else
    seen a simalar problem? Is there a patch or something I need to download?

    Thanks IA


  • Mike Wahler

    #2
    Re: Problems with mod

    "John Smith" <someone@micros oft.com> wrote in message
    news:R2Gib.7544 88$YN5.707251@s ccrnsc01...[color=blue]
    > I'm using Microsoft Visual C++ 6.0. I've been having trouble with my %
    > operator in my code; it doesn't seem to be working correctly.[/color]

    Show us the code, and we'll try to sort it out.
    [color=blue]
    >As a test I
    > typed the following in the Visual Studio quick watch window: "3400 %[/color]
    1515".[color=blue]
    > This evaluated to 0x000009d6 (2518 in decimal). 2518 being larger then
    > 1515, this is not only an inaccurate, but invalid result![/color]

    To me, "inaccurate " and "invalid" mean the same thing in
    this case. :-)
    [color=blue]
    >Has anyone else
    > seen a simalar problem?[/color]

    Not I. I wrote and compiled the following with MSVC++ v6.0 SP5 :

    #include <iostream>

    int main()
    {
    std::cout << 3400 % 1515 << '\n';
    return 0;
    }

    It gives the output:

    370


    When I pasted the expression '3400 % 1515' (without the
    quotes) into a quick watch window and clicked the "Recalculat e"
    button, I got a result of 370. Perhaps you're having trouble
    using your debugger, which is of course not topical here.
    [color=blue]
    > Is there a patch or something I need to download?[/color]

    I believe the latest (and last) patch for MSVC++ v6.0
    is "Service Pack 5", but I doubt this patch (or lack
    of it) has anything to do with your problem (of course
    I could be wrong, Microsoft has been known to do some
    strange things. :-)).

    -Mike


    Comment

    • lilburne

      #3
      Re: Problems with mod

      John Smith wrote:
      [color=blue]
      > I'm using Microsoft Visual C++ 6.0. I've been having trouble with my %
      > operator in my code; it doesn't seem to be working correctly. As a test I
      > typed the following in the Visual Studio quick watch window: "3400 % 1515".
      > This evaluated to 0x000009d6 (2518 in decimal). 2518 being larger then
      > 1515, this is not only an inaccurate, but invalid result! Has anyone else
      > seen a simalar problem? Is there a patch or something I need to download?
      >[/color]

      0x3400 % 0x1515 = 0x09d6

      Comment

      • Jonathan Mcdougall

        #4
        Re: Problems with mod

        > I'm using Microsoft Visual C++ 6.0. I've been having trouble with my[color=blue]
        > % operator in my code; it doesn't seem to be working correctly. As
        > a test I typed the following in the Visual Studio quick watch window:
        > "3400 % 1515". This evaluated to 0x000009d6 (2518 in decimal). 2518
        > being larger then 1515, this is not only an inaccurate, but invalid
        > result![/color]

        If 3400 and 1515 are hex numbers, the result is correct, that is

        0x3400 % 0x1515 = 0x9d6
        [color=blue]
        >Has anyone else seen a simalar problem?[/color]

        What problem?
        [color=blue]
        > Is there a patch or
        > something I need to download?[/color]

        Coffee :)


        Jonathan


        Comment

        • Ron Natalie

          #5
          Re: Problems with mod


          "Jonathan Mcdougall" <jonathanmcdoug all@DELyahoo.ca > wrote in message news:jUJib.4287 8$Mv6.976957@wa gner.videotron. net...[color=blue][color=green]
          > > I'm using Microsoft Visual C++ 6.0. I've been having trouble with my
          > > % operator in my code; it doesn't seem to be working correctly. As
          > > a test I typed the following in the Visual Studio quick watch window:
          > > "3400 % 1515". This evaluated to 0x000009d6 (2518 in decimal). 2518
          > > being larger then 1515, this is not only an inaccurate, but invalid
          > > result![/color]
          >
          > If 3400 and 1515 are hex numbers, the result is correct, that is
          >
          > 0x3400 % 0x1515 = 0x9d6
          >[/color]
          Yep, take your watch window out of Hexademcimal mode (right click on it).


          Comment

          Working...