java-q
java-q copied to clipboard
RealValue and FloatValue should represent Float and Double Java types correspondingly
This is an open question, but KDB doesn't support numeric types with defined precision (aka BigDecimal in Java or NUMBER (precision, scale) is Oracle.
That's why, Java retrieves "real" and "float" KDBs datatypes as Float and Double correspondingly. Converting Float and Double to BigDecimal doesn't give any advantages, but:
- Hides real type from end-user, which can sometimes lead to bugs. Especially when end-user would rounds incoming float/double values and convert them to BigDecimals with his own rules
- Produces unnecessary BigDecimal objects.
It's up to you, but imho, using Float/Double types instead of BigDecimal will make API clearer.
- If you agree with this I can make appropriate change and send it to you for review.
I agree with you. Converting to BigDecimal is something most users want to do on their own because they need to know the corresponding tick value. This change will break the API so I suggest that the version will then change to 2.0.0.