On Fri, Sep 18, 2020 at 4:26 AM Mike Samuel <mikes...@gmail.com> wrote:
> If denominator's type before the if is base.u32[-100 ..= 101] do you further specialize that to [-100, 0)∪[1, 101) internally
Yes!
https://github.com/google/wuffs/blob/9557d89c5658b16d713d5c1afaa8ad80170da620/lib/interval/interval.go#L655
But, a few lines above, if the denominator range y contains 0, we just
return ok == false.
> Did you reject range arithmetic like Racket's data/integer-set for pragmatic reasons?
A single range is simpler than multiple ranges, and we haven't needed
multiple ranges so far.
FWIW, in the 11 packages under std/, the only uses of division so far
are to divide by constant powers-of-2, such as "x / 16" or "(y + 7) /
8", which could easily be re-written as right-shifts.