LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remainder

Hey Everyone! Can you please tell me what is the purpose of a remainder. Like, why do we use it? What do we get from it?

 

Thanks

 

0 Kudos
Message 1 of 7
(3,816 Views)

Can you please tell me what is the purpose of a remainder. Like, why do we use it? 

0 Kudos
Message 2 of 7
(3,782 Views)

The Quotient and Remainder function calculates the largest integer that can be multiplied by the input value to provide a number less than the other input - this is the Quotient. The Remainder is the left-over part. 

Spoiler
For example, 14  / 4 -> 3*4 + 2, so the Quotient is 3 and the Remainder is 2.

 

When the y input is 3, the output of the remainder (for monotonically, single increment increasing x like you get from the 'i' terminal) is 0, 1, 2, 0, 1, 2, 0, 1, 2...

 

This allows us to test the Remainder against 0, and that value is T, F, F, T, F, F... which allows a conditional output tunnel to output one in every 3 values.


GCentral
Message 3 of 7
(3,781 Views)

Just one example from the many, see the snippet below. But the modulo generation (my English is bad, so i am not sure about the proper terms here) is widely used in mathematics and computer science. So this "Quotient & Remainder" function is not a special LabVIEW thing, we need such functions in any computer language, etc...

 

Also see this wiki: https://en.wikipedia.org/wiki/Modular_arithmetic

 

Edit: and the naming "Frequency" is a bit misleading. Since if its value is higher, the Led will lit up less frequent 🙂 So we could call it period-length 🙂 Or you do an extra calculation step, to take a reciprocal...

 

remainder.png

Message 4 of 7
(3,799 Views)

Although I already gave this in a different thread (to the same OP 😉 ) I'll paste it here for completeness. Blokk's example gives a very detailed answer and some nice comment on the block diagram of his snippet!

 

 

The Quotient and Remainder function calculates the largest integer that can be multiplied by the input value to provide a number less than the other input - this is the Quotient. The Remainder is the left-over part. For example, 14  / 4 -> 3*4 + 2, so the Quotient is 3 and the Remainder is 2.

 

 When the y input is 3, the output of the remainder (for monotonically, single increment increasing x like you get from the 'i' terminal) is 0, 1, 2, 0, 1, 2, 0, 1, 2...

 

This allows us to test the Remainder against 0, and that value is T, F, F, T, F, F... which allows a conditional output tunnel to output one in every 3 values.


GCentral
0 Kudos
Message 5 of 7
(3,783 Views)

@Blokk wrote:

But the modulo generation (my English is bad, so i am not sure about the proper terms here) is widely used in mathematics and computer science.


It is especially important in cryptography since many algorithms are based on modulo math with prime numbers as the base.

 

But my most common use is the "do this every X iterations" as you guys have already shown.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(3,756 Views)

As well often used in random number generation.

https://en.m.wikipedia.org/wiki/Linear_congruential_generator

0 Kudos
Message 7 of 7
(3,747 Views)