eclipse-basyx / basyx-java-sdk

java-sdk
MIT License
25 stars 32 forks source link

Adding ValueType "decimal" #289

Closed tilman19 closed 1 year ago

tilman19 commented 1 year ago

The type "decimal" is in use in some standardized submodels like the digital nameplate. The change handles decimals the same as double, which should hopefully not harm precision in any real world scenario.

FrankSchnicke commented 1 year ago

Thank you very much for providing this PR. However, due to the precision differences between double and decimal, it would be better to use java.math.BigDecimal as data type for decimal. Would it be possible to update the PR in this regard and also add a test in TestValueTypeHelper covering this aspect?

tilman19 commented 1 year ago

I just updated the pull request. Handling empty values needs a little bit of attention using BigDecimal as no NaN is available. I decided to put those values to a 0. Are there any better options in your oppinion?

FrankSchnicke commented 1 year ago

Fine with me, thank you very much!