M2 icon indicating copy to clipboard operation
M2 copied to clipboard

quotient and modulus for non-integers are wrong

Open mahrud opened this issue 1 year ago • 3 comments

Unless I'm way off about what we want // and % to mean, I think these are all wrong: https://github.com/Macaulay2/M2/blob/ec9e9ac60ed4a8e791448942202f077a88a87e15/M2/Macaulay2/m2/reals.m2#L213-L226

Some examples: (afterprints are silenced)

i1 : 13.3 // 4.0

o1 = 3.325

i2 : 13.3 % 4.0

o2 = 0

i3 : 13.3 // 4

o3 = 3.325

i4 : 13.3 % 4

o4 = 0

i5 : 13.3 // (4/1)

o5 = 3.325

i6 : 13.3 % (4/1)

o6 = 0

i7 : (pi*ii) // 3.0

o7 = 1.0471975511966*ii

i8 : (pi*ii) % 3.0

o8 = 0

What's the point of having // be a synonym for /, and why even define % for non-integers if the answer is always zero anyway?!

mahrud avatar Jun 30 '24 05:06 mahrud