-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add support for Decimal and Decimal score types #110
feat: add support for Decimal and Decimal score types #110
Conversation
- Decimal maps mostly to BigDecimal, although its floating point concepts are ignored (Python does not have an infinite precision MathContext, so it acts more like a dynamic range floating point with an adjustable precision. The precision used is shared in a thread local object that can be changed using decimal.setcontext. - Added `str` constructors to `float` and `int` - Added sanity tests for all variants of penalize/reward/impact and score types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving some comments.
A question regarding LoadBalance
- the class has a BigDecimal
-returning method. I don't see any code handling that here. So the conversion to Python Decimal
happens automatically?
jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonFloat.java
Outdated
Show resolved
Hide resolved
jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonInteger.java
Outdated
Show resolved
Hide resolved
jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonNumber.java
Outdated
Show resolved
Hide resolved
jpyinterpreter/src/main/java/ai/timefold/jpyinterpreter/types/numeric/PythonDecimal.java
Show resolved
Hide resolved
All |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after we're back to at least B in Sonar.
(We may have to disable the ThreadLocal
rule there, even though it's entirely correct and points out the main reason why ThreadLocal
should be avoided.)
- Use predicate so we don't need to implement DecimalTuple for now
|
Decimal maps mostly to BigDecimal, although its floating point concepts are ignored (Python does not have an infinite precision MathContext, so it acts more like a dynamic range floating point with an adjustable precision. The precision used is shared in a thread local object that can be changed using decimal.setcontext.
Added
str
constructors tofloat
andint
Added sanity tests for all variants of penalize/reward/impact and score types