Add BigFloat type
Opened this issue · 0 comments
Related to bug #8 . In order to allow really big numbers (with very large exponents), Decimal isn't enough, so we need to introduce a float point type.
PHP's float/double type also allows very large numbers, but exponents limits vary from 256 values to 16536 values depending on the CPU, with a BigFloat type we can work with very large exponents. This type will be slower than native the native float type, but the tradeoff is worth. The explanation about exponents it's also applicable to mantissas.
It's important to implement conversion methods 'from & to' Decimal objects in the numeric range where it's possible.
It would be nice if we implement in the Decimal type a system to detect when it's preferable to switch to BigFloat. Maybe capturing memory exhaustion exceptions and handling it?