Somebody check the sums which was fun working out. I have a sensor which gives out 4096 pulses per revolution. This is attached to a motor which turns at 1000 rpm. I need to count by using an integer in increments defined by a signed 64 bit integer. The question is, how long can it count for at this speed before the integer overflows? 64 bits is about + or - 9.23 x10^18 count in one direction only before overflow. 1000 revs/min x 60 min/hr = 60,000 revs/hr of the motor. 60,000 revs/hr x 4096 pulses/rev = 2.457 x10^8 pulses/hour There are 24 hrs/day and 365 days/year therefore 8760 hrs/year Therefore 9.23 x 10^18/2.457 x 10^8 pulses/hour =3.767x10^10 hrs to reach overflow of the counter integer. This is 4.3 x 10^6 years or 4.3 million years!! Surely some mistake

# Counter and length of count

Started by ●January 8, 2019

Reply by ●January 8, 20192019-01-08

On 1/8/19 4:37 PM, gyansorova@gmail.com wrote:> Somebody check the sums which was fun working out. > > I have a sensor which gives out 4096 pulses per revolution. This is attached to a motor which turns at 1000 rpm. I need to count by using an integer in increments defined by a signed 64 bit integer. The question is, how long can it count for at this speed before the integer overflows? > > 64 bits is about + or - 9.23 x10^18 count in one direction only before overflow. > > 1000 revs/min x 60 min/hr = 60,000 revs/hr of the motor. > > 60,000 revs/hr x 4096 pulses/rev = 2.457 x10^8 pulses/hour > > There are 24 hrs/day and 365 days/year therefore 8760 hrs/year > > Therefore 9.23 x 10^18/2.457 x 10^8 pulses/hour =3.767x10^10 hrs to reach overflow of the counter integer. > > This is 4.3 x 10^6 years or 4.3 million years!! > > Surely some mistake > >Nope, I get that too. For any actual physical quantity, 2^64 is utterly enormous. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.

Reply by ●January 9, 20192019-01-09

On 09.01.2019 3:37, gyansorova@gmail.com wrote:> Somebody check the sums which was fun working out. > > I have a sensor which gives out 4096 pulses per revolution. This is attached to a motor which turns at 1000 rpm. I need to count by using an integer in increments defined by a signed 64 bit integer. The question is, how long can it count for at this speed before the integer overflows? > > 64 bits is about + or - 9.23 x10^18 count in one direction only before overflow. > > 1000 revs/min x 60 min/hr = 60,000 revs/hr of the motor. > > 60,000 revs/hr x 4096 pulses/rev = 2.457 x10^8 pulses/hour > > There are 24 hrs/day and 365 days/year therefore 8760 hrs/year > > Therefore 9.23 x 10^18/2.457 x 10^8 pulses/hour =3.767x10^10 hrs to reach overflow of the counter integer. > > This is 4.3 x 10^6 years or 4.3 million years!! > > Surely some mistake > >It's extremely helpful that you have written this commentary. If the motor fails after some 4.3 million years, we know who to blame. ^_^ Evgeny.

Reply by ●January 9, 20192019-01-09

On Wednesday, January 9, 2019 at 11:43:18 PM UTC+13, Gene Filatov wrote:> On 09.01.2019 3:37, gyansorova@gmail.com wrote: > > Somebody check the sums which was fun working out. > > > > I have a sensor which gives out 4096 pulses per revolution. This is attached to a motor which turns at 1000 rpm. I need to count by using an integer in increments defined by a signed 64 bit integer. The question is, how long can it count for at this speed before the integer overflows? > > > > 64 bits is about + or - 9.23 x10^18 count in one direction only before overflow. > > > > 1000 revs/min x 60 min/hr = 60,000 revs/hr of the motor. > > > > 60,000 revs/hr x 4096 pulses/rev = 2.457 x10^8 pulses/hour > > > > There are 24 hrs/day and 365 days/year therefore 8760 hrs/year > > > > Therefore 9.23 x 10^18/2.457 x 10^8 pulses/hour =3.767x10^10 hrs to reach overflow of the counter integer. > > > > This is 4.3 x 10^6 years or 4.3 million years!! > > > > Surely some mistake > > > > > > It's extremely helpful that you have written this commentary. If the > motor fails after some 4.3 million years, we know who to blame. > > ^_^ > > Evgeny.I think it's great to know that your motor will still be operating after humans are extinct!

Reply by ●January 10, 20192019-01-10

On Tue, 8 Jan 2019 16:37:15 -0800 (PST), gyansorova@gmail.com wrote:>Somebody check the sums which was fun working out. > >I have a sensor which gives out 4096 pulses per revolution. This is attache= >d to a motor which turns at 1000 rpm. I need to count by using an integer i= >n increments defined by a signed 64 bit integer. The question is, how long= > can it count for at this speed before the integer overflows? > >64 bits is about + or - 9.23 x10^18 count in one direction only before over= >flow. > >1000 revs/min x 60 min/hr =3D 60,000 revs/hr of the motor. > >60,000 revs/hr x 4096 pulses/rev =3D 2.457 x10^8 pulses/hour > >There are 24 hrs/day and 365 days/year therefore 8760 hrs/year > >Therefore 9.23 x 10^18/2.457 x 10^8 pulses/hour =3D3.767x10^10 hrs to reac= >h overflow of the counter integer. > >This is 4.3 x 10^6 years or 4.3 million years!! > >Surely some mistake >=20 >There are estimates that there are 10^78 to 10^80 atoms in the universe. You can count to ~10^77 with 256 bits, just to get reasonably close. You can build a 256-bit counter in silicon without too much trouble and clock it at around 1GHz. It'd still take 3.67^60 years to count reasonaby close to all the atoms in the universe with that counter. This makes a good case for parellelism. ;)

Reply by ●February 7, 20192019-02-07

On Tuesday, January 8, 2019 at 5:13:12 PM UTC-8, Rob Gaddi wrote: (snip)> Nope, I get that too. For any actual physical quantity, 2^64 is utterly > enormous.Enormous enough that you wouldn't think that IPv6 would use 128 bit addresses. I have, from Comcast, 2^68 IP addresses for my home networks. (So far, I have two subnets with 2^64 each.)