Solved kcalc modulo bug?

Why is it that math kde-applications kde/kcalc return 0 when asking 1.1 mod 1 or any other floating numbers mod 1?
I use scientific mode.
freebsd 14.2
Name : kcalc
Version : 23.08.5

Screenshot_20250114_171455.png
 
I don't know the internals of kcalc (or xcalc, for that matter), but it seems they don't have variable scale. Consider:

Code:
% dc
Kp
0
3.75 1%p
.75
1k
3.75 1%p
.05
2k
3.75 1%p
0
 
I believe that all of this is meaningless.

As previously stated, modular arithmetic is defined for the integers therefore the result of a modular operation on rational or real numbers is undefined. With that said, I don't use kcalc but to me what I see is correct as any integer gives a residue of zero modulo one because any integer is of course divisible by one.
 
That's not entirely true, though. But I suspect nobody wants to be bored by ring theory....
I suspect you're referring to the "numerator is divisible by the modulo and the denominator shares no common factor with it" definition, aren't you? Anyways, in this case we were talking about "modulo 1" things therefore the numerator is always divisible by one and the denominator of course shares no common factor with one (exept one itself, of course), so the result is always zero IMHO.
 
It seem that some calculator don't handle floating-point arithmetic, floating-point modulus, where the modulus operator work with the exact decimal value, including the fractional part, this is the case for math/kcalc. which support only integer modulus.
 
Back
Top