Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Binary Division Problem Help (http://www.velocityreviews.com/forums/t445366-binary-division-problem-help.html)

jamestuck21 11-30-2006 06:27 PM

Binary Division Problem Help
 
Hi,

I'm trying to work out a binary division problem

1100 / 101010101010111

Here is what I have so far but I'm not sure if I'm doing it correctly
and I'm suppose to continue the division until there is only a
remainder left

110
______________________
1100 [ 101010101010111
1100
_______________
1101
1100
_______________
01010
1100
_____________
110

I'm not sure if I'm doing this correctly and I don't really have a way
of checking if I'm doing it right. Does anyone know of a simple web
calculator that I can check against my answer or if someone could run
through this example with me, that would be great. thank you


santosh 11-30-2006 06:39 PM

Re: Binary Division Problem Help
 
jamestuck21 wrote:
> Hi,
>
> I'm trying to work out a binary division problem

<snip>

Post to sci.math


Ben Pfaff 11-30-2006 06:41 PM

Re: Binary Division Problem Help
 
"jamestuck21" <cpp_is_fun@yahoo.com> writes:

> I'm trying to work out a binary division problem
>
> 1100 / 101010101010111


The integer quotient is 0, as always when the divisor is greater
than the dividend, for positive operands. The remainder is 1100.
--
Ben Pfaff
email: blp@cs.stanford.edu
web: http://benpfaff.org

Fred Kleinschmidt 11-30-2006 07:27 PM

Re: Binary Division Problem Help
 

"jamestuck21" <cpp_is_fun@yahoo.com> wrote in message
news:1164911277.856776.198390@l39g2000cwd.googlegr oups.com...
> Hi,
>
> I'm trying to work out a binary division problem
>
> 1100 / 101010101010111
>
> Here is what I have so far but I'm not sure if I'm doing it correctly
> and I'm suppose to continue the division until there is only a
> remainder left
>
> 110
> ______________________
> 1100 [ 101010101010111
> 1100
> _______________
> 1101
> 1100
> _______________
> 01010
> 1100
> _____________
> 110
>
> I'm not sure if I'm doing this correctly and I don't really have a way
> of checking if I'm doing it right. Does anyone know of a simple web
> calculator that I can check against my answer or if someone could run
> through this example with me, that would be great. thank you
>


You have
A=1100
B=101010101010111

Your first question asks how to take A/B

But your division example tries (incorrectly) to do B/A

Try a newsgroup like sci.math. But be sure you know which division you want!
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project




Al Balmer 11-30-2006 09:39 PM

Re: Binary Division Problem Help
 
On 30 Nov 2006 10:27:57 -0800, "jamestuck21" <cpp_is_fun@yahoo.com>
wrote:

> Does anyone know of a simple web
>calculator that I can check against my answer or if someone could run
>through this example with me, that would be great. thank you


Does it have to be on the web? Since you're appear to be posting from
Windows, I'd suggest the Windows calculator, in scientific mode.

11100011100

--
Al Balmer
Sun City, AZ

jamestuck21 12-01-2006 12:23 AM

Re: Binary Division Problem Help
 
Windows calculator does not give the correct solution.

An example that I worked out with the correct solution is not the same
as the windows calculator is giving

1001 / 101110000

Solution = 101011 with Remainder of 011 and the remainder is what I'm
interested in.


Al Balmer wrote:
> On 30 Nov 2006 10:27:57 -0800, "jamestuck21" <cpp_is_fun@yahoo.com>
> wrote:
>
> > Does anyone know of a simple web
> >calculator that I can check against my answer or if someone could run
> >through this example with me, that would be great. thank you

>
> Does it have to be on the web? Since you're appear to be posting from
> Windows, I'd suggest the Windows calculator, in scientific mode.
>
> 11100011100
>
> --
> Al Balmer
> Sun City, AZ



Ben Pfaff 12-01-2006 12:38 AM

Re: Binary Division Problem Help
 
"jamestuck21" <cpp_is_fun@yahoo.com> writes:

> An example that I worked out with the correct solution is not the same
> as the windows calculator is giving
>
> 1001 / 101110000
>
> Solution = 101011 with Remainder of 011 and the remainder is what I'm
> interested in.


There's no way that the quotient to that division can be 101011.
That's as silly as saying that 1234 / 123456789 = 456789.
Dividing a small number by a large number yields 0, with the
small number as remainder.
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

jamestuck21 12-01-2006 12:45 AM

Re: Binary Division Problem Help
 
This is an example on calculating the remainder in use with CRC. Maybe
I might of not explained it properly, but that is the correct solution
and this is using binary division to get a quotient and specifically
interested in the remainder value because that is the extra amount of
bits tacked onto a file for checksum.


Ben Pfaff wrote:
> "jamestuck21" <cpp_is_fun@yahoo.com> writes:
>
> > An example that I worked out with the correct solution is not the same
> > as the windows calculator is giving
> >
> > 1001 / 101110000
> >
> > Solution = 101011 with Remainder of 011 and the remainder is what I'm
> > interested in.

>
> There's no way that the quotient to that division can be 101011.
> That's as silly as saying that 1234 / 123456789 = 456789.
> Dividing a small number by a large number yields 0, with the
> small number as remainder.
> --
> "Debugging is twice as hard as writing the code in the first place.
> Therefore, if you write the code as cleverly as possible, you are,
> by definition, not smart enough to debug it."
> --Brian Kernighan



Coos Haak 12-01-2006 12:46 AM

Re: Binary Division Problem Help
 
Op 30 Nov 2006 16:23:36 -0800 schreef jamestuck21:

> Windows calculator does not give the correct solution.
>
> An example that I worked out with the correct solution is not the same
> as the windows calculator is giving
>
> 1001 / 101110000
>
> Solution = 101011 with Remainder of 011 and the remainder is what I'm
> interested in.
>
>
> Al Balmer wrote:
>> On 30 Nov 2006 10:27:57 -0800, "jamestuck21" <cpp_is_fun@yahoo.com>
>> wrote:
>>
>>> Does anyone know of a simple web
>>>calculator that I can check against my answer or if someone could run
>>>through this example with me, that would be great. thank you

>>
>> Does it have to be on the web? Since you're appear to be posting from
>> Windows, I'd suggest the Windows calculator, in scientific mode.
>>
>> 11100011100

<OT>
Why didn't you use the 'MOD' button on the Windows calculator?
(I am lucky to know Forth, '/MOD' gives the quotient and remaider at once.)
</OT>
--
Coos

jamestuck21 12-01-2006 12:49 AM

Re: Binary Division Problem Help
 
The mod button does not give you the correct solution. It just returns
the original value that you're trying to use to divide into.


Coos Haak wrote:
> Op 30 Nov 2006 16:23:36 -0800 schreef jamestuck21:
>
> > Windows calculator does not give the correct solution.
> >
> > An example that I worked out with the correct solution is not the same
> > as the windows calculator is giving
> >
> > 1001 / 101110000
> >
> > Solution = 101011 with Remainder of 011 and the remainder is what I'm
> > interested in.
> >
> >
> > Al Balmer wrote:
> >> On 30 Nov 2006 10:27:57 -0800, "jamestuck21" <cpp_is_fun@yahoo.com>
> >> wrote:
> >>
> >>> Does anyone know of a simple web
> >>>calculator that I can check against my answer or if someone could run
> >>>through this example with me, that would be great. thank you
> >>
> >> Does it have to be on the web? Since you're appear to be posting from
> >> Windows, I'd suggest the Windows calculator, in scientific mode.
> >>
> >> 11100011100

> <OT>
> Why didn't you use the 'MOD' button on the Windows calculator?
> (I am lucky to know Forth, '/MOD' gives the quotient and remaider at once.)
> </OT>
> --
> Coos




All times are GMT. The time now is 05:33 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57