Hello everyone.
What is the best type to use for price value? Is it Double or Float? I am using Realm objects.
The price should contain only 2 decimals. (10.55$)
Have a nice day!
Hello everyone.
What is the best type to use for price value? Is it Double or Float? I am using Realm objects.
The price should contain only 2 decimals. (10.55$)
Have a nice day!
Hi @Ciprian_Gabor,
For prices you want to use the Decimal128 type so all the calculations are absolutely exact (and not rounded to the next float or double) because of the IEEE 754.
Cheers,
Maxime.
Thanks for you answer, what types should I use for Kotlin and SwiftUI
id("io.realm.kotlin") version "1.4.0"
That’s what I suspected earlier.
Currently, Kotlin SDK doesn’t support Decimal128 which is why you couldn’t find the type but would be available soon. With this said and considering this limitation I would use Double as they are more accurate when doing price calculations.
Thanks!
Do you have any exact date when is going to be available?
Sorry, I don’t have an update regarding that.