Search code examples
decimalhaxe

Floating decimal point type in Haxe


Is there floating decimal point type in Haxe (similar to decimal.Decimal in Python, i.e. http://en.wikipedia.org/wiki/IEEE_854-1987)? For the application I have float is not an option due to possible precision problems.


Solution

  • I don't think anything like that exists in the standard library, apart from target-specific externs such as java.math.BigDecimal. So if you want a cross-platform solution, you would need a third-party library.

    One that comes to mind is thx.Decimal from the thx.core library. Having a look at the associated test cases may be helpful since there's not much documentation.