michaelwittig / java-q

Q interfacing with Java
Apache License 2.0
25 stars 6 forks source link

RealValue and FloatValue should represent Float and Double Java types correspondingly #16

Open anton-dovzhenko opened 9 years ago

anton-dovzhenko commented 9 years ago

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:

  1. 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
  2. Produces unnecessary BigDecimal objects.

It's up to you, but imho, using Float/Double types instead of BigDecimal will make API clearer.

michaelwittig commented 9 years ago

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.