uniconproject / unicon

http://www.unicon.org
Other
54 stars 28 forks source link

Add classes to uni/lib that implement fixed point arithmetic. #363

Closed Don-Ward closed 3 months ago

Don-Ward commented 3 months ago

If operator overloading is configured the classes will support it. Otherwise, the alternative methods (add, sub etc.) can be used in place of the infix operators. Test code is in tests/unicon. There are two sets of tests, one with overloading and one without (one is a superset of the other). Unidoc documentation is embedded in the source code.

StephenWampler commented 3 months ago

I'm happy with this - looks good. The bug report in neg() is interesting in that I would have expected the original code to either error both in and out of a package or work in both cases. I take it the expression in a static assignment is executed at a different environment or point in time from the code in an initial clause. Is there a good reason for that? I think I've always thought of them as equivalent.

Don-Ward commented 3 months ago

I'm happy with this - looks good. The bug report in neg() is interesting in that I would have expected the original code to either error both in and out of a package or work in both cases. I take it the expression in a static assignment is executed at a different environment or point in time from the code in an initial clause. Is there a good reason for that? I think I've always thought of them as equivalent.

I've reported it to "the authorities". I've left the workaround(s) in because we can't be sure that everyone will have the updated compiler (when it arrives). In passing, I think the dependencies in the class source code on the package name is particularly ugly but we are stuck with how packages are implemented I guess.