Modulo 1?

And so in js there is the % operator is the remainder from dividing it is convenient to check the parity of a number ( n%2 == 0 ) and ATTENTION the whole the number type if integer, then num%1 will be zero if the fraction is 0+the fraction but I can not understand because if you divide a number by 1 is not 0 ie ostach will always be the number which the mi is divided by 1.
I may not know math or UTB pin js explained to the pancreas.
sory for the diploma too lazy to put Russian characters.
March 19th 20 at 08:44
2 answers
March 19th 20 at 08:46
Solution
% is the operation of taking the remainder, not the quotient. The remainder of dividing any integer by 1 is 0, since any integer can be represented as a sum of units, and 1 is divisible by 1 without remainder.

Example:
3% 1 = 3 (mod 1) = 1 + 1 + 1 (mod 1) = 0 + 0 + 0 = 0
thanks for the reply I got stupid - heather_Ri commented on March 19th 20 at 08:49
March 19th 20 at 08:48
if integer, then num%1 will be zero


An integer divided by 1, always gives himself:
x : 1 = x
dude at least read th written dokonca and then write comments
and if you believe that wrong then throw a screen from codePen that num%1 num a is not 0 - heather_Ri commented on March 19th 20 at 08:51
@heather_Ri, the remainder of the division. If you divide any number by 1 ,but the division remains nothing that is zero. If you divide 3 by 2 ,the remainder 1 if you divide 3 by 1 ,the remainder 0 ,as divided without a remainder. - Arvel commented on March 19th 20 at 08:54
@heather_Ri, person you an example of DIVIDING the led and not the rest. You all correctly returned zero means that NO balance and the number NUM quietly shares 1. Simply by dividing the number NUM to 1 to equal the expression is NUM, and the remainder will be 0. - joy_Hayes commented on March 19th 20 at 08:57
@heather_Ri, what does codeine? I'm a mathematical rule written. - stewart66 commented on March 19th 20 at 09:00
@Arvel, thanks man I realized I just did not think in this way - heather_Ri commented on March 19th 20 at 09:03
@stewart66, @stewart66well, and I also wrote in my post that num/1 = num but then 1 person so I wanted to show that know the math for the 2nd class that I wrote the same thing even without having read the post until the end, thanks for your answer, now go get a cookie. - heather_Ri commented on March 19th 20 at 09:06

Find more questions by tags MathematicsJavaScript