Decimal fields are limited to four digits after the decimal point. 4 is hard coded for decimal fields in formatted_number_field_settings for no reason that I can see, while Float fields are allowed 20.
I have a case where I need to store numbers mostly between 0 and 1 (up to 99) with at least 9 significant figures (or 9 decimal places for most of the numbers). Yes, it needs to be very precise. For example; 0.113126517 and 0.970089730. By changing the code to allow a range of 0 to 20 digits after the decimal place I can achieve this, and everything works fine.
Otherwise I am limited to 4 decimal places or 7 significant figures (perhaps on MySQL only?) if I use a Float field (instead of a Decimal field), which is insufficiently precise.
I have attached a patch which enables 20 decimal places to be stored for both Decimal fields and Float fields. (I do not think that it means anything for Floats. That is just what it already was.)
Is there a better way to do this?
| Comment | File | Size | Author |
|---|---|---|---|
| formatted_number-store-20-decimal-places.patch | 718 bytes | Bevan |
Comments
Comment #1
kenorb commentedComment #2
kenorb commentedClosed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.