Re: div & mod don't coerce arguments to Int?

2021-12-18 Thread William Michels via perl6-users
Does `mod` depend on `div`? I'm guessing that's what's going on. From Wikipedia's "Modulo operation" entry: "Although typically performed with a and n both being integers, many computing systems now allow other types of numeric operands." https://en.wikipedia.org/wiki/Modulo_operation Best,

div & mod don't coerce arguments to Int?

2021-12-18 Thread Sean McAfee
While coding today, I was a little surprised to discover that the div operator doesn't coerce its arguments to integers. So for example, the expressions 25 div '5' and pi div 5 raise errors. I checked the Operators doc page and saw that, sure enough, div (and mod, I found) accept only actual