-
Notifications
You must be signed in to change notification settings - Fork 692
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
Improve performance and API with Decimals for very big and very small values #26
Comments
I don't think introducing the concept of currencies via Joda-Money is a good idea currently. Using standards is good and I was excited when I saw that ta4j used Even if we decide to add Joda-Money we will still need some regular In mdeverdelhan/ta4j-origins#28 Decimal4j was discussed as a Some quotes by @mdeverdelhan from the issues you listed:
|
Why do you refer to #21 ? |
The @mdeverdelhan quotes are very relevant, after thinking about it I think there are several reasons I would be against the idea of adding currency:
|
Might be worth splitting this issue into
|
@martinklepsch good idea, I think a more performant Decimal implementation with standard types is straight forward, too. But I am also concerned about introduction of currencies. |
@mdeverdelhan pointed out that Decimal4j's implementation makes some tradeoffs for performance. Specifically because the underlying value is represented as a single long, you can either have precision to the left or to the right of the decimal point but not both. From http://decimal4j.org/javadoc/1.0.3/org/decimal4j/api/Decimal.html:
This seems undesirable for a library like ta4j, especially considering that this would be a premature optimisation (considering nobody has performance issues caused by the use of |
Right now we have a custom implemented Decimal class. This class solves issues like:
Sadly it still leaves out some other issues:
Personally I prefer using standards. Previously I used Joda Time, and the integration into the JDK made many things much easier. So I assume also that the integration of Money and Currency JSR will also make many things pretty simple. Here a short intro http://www.baeldung.com/java-money-and-currency
Also JSR-354 has already considerations about the tradeoff of performance and precision. E.g. the user of our API could himself decide which precision he/she wants to use by using either Money (BigDecimal based) or FastMoney (long based) implementation.
Since it will make its way into the JDK it will soon be obsolete as a additional dependency right it is now as the reference implementation.
Good readings for the decision:
mdeverdelhan/ta4j-origins#19, mdeverdelhan/ta4j-origins#28, mdeverdelhan/ta4j-origins#4 (comment)
Also related to this are: #24 and #21
The rework for this Decimal issue will take some time, therefore I would like to move it to version 0.11
What do you think about the proposed Java Money and Currency and about the move to release 0.11?
The text was updated successfully, but these errors were encountered: