-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Number Comparator #15
Conversation
4e6597d
to
a59cd33
Compare
I think there are some very valuable contributions here, and I'm intrigued about your approach. I am concerned about performance - I notice that you are performing subtraction internally in some substeps. To me, comparison should be 'strictly simpler' than subtraction, even for decimal numbers. Re ontology, I am drawn to potential future modules By encoding core arithmetic logic in Finally, re your two failed test cases, I have a suspicion that this might be related to an interesting bit of nuance I found the other day re the current |
a59cd33
to
bbe5ef6
Compare
I definitely agree with having distinct I rewrote the
|
bbe5ef6
to
32f0d0d
Compare
c0e3707
to
da94fcb
Compare
- exposes `_$fromString2` method which doesn't trim leading zeros.
- SUPERSEDED by subsequent commit - TODO: resolve "ts(2589) type instantiation is excessively deep" error for test case `42.04, 42.02`.
- Simpler implementation for `_$decimalCompare` that doesn't rely on `DigitList.Subtract` and should have less performance overhead. - "Type instantiation is excessively deep..." error persists for test case `42.04, 42.02`, but no longer occurs for `42.02, 42.04`. - Anomaly: Replacing `A_DONE, B_DONE` in line 43 with their defaults from lines 39-40 results in the following error. Possible bug in `Boolean._$and` or `Conditional._$equals`? ``` error TS2344: Type '0 | 1 | -1' does not satisfy the constraint '1 & _'. Type '0' is not assignable to type '1 & _'. Type '0' is not assignable to type '1'. ```
da94fcb
to
c0fe416
Compare
That is a fantastic idea. Can't believe I never thought to try that. |
I suspect you will find this in short order. I have gotten all tests to pass on my side. Check out my |
- Returning `never` instead of accumulator caused errors in decimal compare implementation
Wow that turned out to be a really simple fix. Thanks for the sanity-restoring debugging tips.😂 |
natural-numbers
, signedintegers
anddecimals
.decimalCompare
is only intended to compare user-inputted exact decimal values, not binary representations with rounding.resolve "ts(2589) type instantiation is excessively deep" error for test case42.04, 42.02
.Fractional
module for exact representation of fractions.Decimal
andDecimalDigitList
modules.digit-list
from-string
method_$fromString2
method which doesn't trim leading zeros.number
absolute
method