Re:Python, unlike C, has the mod operator always return a po...
by desio on Wednesday December 29, 2021 @05:30PM
(#29730946)
sorry, rational, not real.
Re:Python, unlike C, has the mod operator always return a po...
by jounker on Thursday December 30, 2021 @02:13AM
(#29734467)
Depends on your definition of division. It you choose a definition which is closed (e.g. you’re working in number theory) then division of integers can only produce other integers.
not true. if you define 'divide' as inverse multiplication over the reals then that is closer to being true (zero is an integer, dividing an integer by zero doesn't yield a real). in that case every real can be expressed as n = a/b where a and b are integers and b != 0 then yes n is a real.
But 'divide' could just as well be defined along the lines of divisibility in number theory (the study of integers) where every integer can be expressed as n = q*b + r, where n,q,b,r are all integers and r >= 0 > b. then you could say that n divide b = q, with r as remainder, and n mod b = r. These are my preferred definition of mod and integer division.