Connecting Tech Pros Worldwide Forums | Help | Site Map

Problems with mod

John Smith
Guest
 
Posts: n/a
#1: Jul 19 '05
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
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Problems with mod


"John Smith" <someone@microsoft.com> wrote in message
news:R2Gib.754488$YN5.707251@sccrnsc01...[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 "Recalculate"
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


lilburne
Guest
 
Posts: n/a
#3: Jul 19 '05

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

Jonathan Mcdougall
Guest
 
Posts: n/a
#4: Jul 19 '05

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


Ron Natalie
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Problems with mod



"Jonathan Mcdougall" <jonathanmcdougall@DELyahoo.ca> wrote in message news:jUJib.42878$Mv6.976957@wagner.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).


Closed Thread