Looking at Arithmetic Expansions I noticed the omission of a floor division operator. I was wondering if that was a conscious decision or if it might still be added in the future.
I have no strong feelings either way, but it seems to be a nice feature. It’s easy to make a floor division function:
fn floor_division dividend:int divisor:int
let remainder = $((dividend % divisor))
let dividend = $((dividend - remainder))
echo $((dividend / divisor))
end
But it doesn’t seem possible to make it usable inside an arithmetic expansion. If it was possible it could turn this:
$(( ((dividend - (dividend % divisor)) / divisor) ))
Into this:
$(( dividend // divisor ))