Problems with mod 
July 19th, 2005, 07:11 PM
| | | 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 | 
July 19th, 2005, 07:11 PM
| | | 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 | 
July 19th, 2005, 07:11 PM
| | | 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 | 
July 19th, 2005, 07:12 PM
| | | 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 | 
July 19th, 2005, 07:12 PM
| | | 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). | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|