Open Toutouwai opened 6 years ago
…more intuitive and less confusing than a float type.
This one totally depends on the use-case and knowledge level of the user, but having both float and decimal is certainly not the wrong way to go. At least informing the users about the differences and link to the decimal module. In the end we have a lot of users without in depth knowledge of the complexities behind float / decimal calculation and we might want to prevent uninformed decisions by those users. Lot's of them still probably don't need decimals and their additional complexities in handling them in php.
Even better, add decimal to the core, it's a very common data type when working with numbers. Heck, almost all other SQL data types are supported. Even if float has PHP or database limitations, I don't want to be bothered with this when working with a CMS. It's an annoyance to discover floats have precision issues when working with large numbers, but since I'm not a mathematician, I just want it to work. As a comparison, you wouldn't like a text field that didn't save spaces, or omitted every 7th character.
If it's in the core, you can still change the field type later on (to integer, float, text or decimal) when you edit a numeric field, without the need of creating a new field and copying existing page data to it.
If it's in the core, you can still change the field type later on (to integer, float, text or decimal) when you edit a numeric field, without the need of creating a new field and copying existing page data to it.
In case you come across this scenario, you can make use of the Admin Tools panel in Tracy to change the fieldtype from float to decimal.
I am not suggesting this is the right approach, but there has been no word from Ryan about incorporating a decimal fieldtype into the core, so this can help out in a pinch. Of course there are other ways to change the type (API, database modification), but this makes it easy.
Decimal filedtype is now in the core https://github.com/processwire/processwire/commit/3603cdb7441b940b2c520c942789cd48ceeca518
Short description of the enhancement
Please add some explanation and guidelines around the limitations of FieldtypeFloat in the field config descriptions. The limitations of the float field in PW are known and have been investigated and discussed years ago in this forum topic.
Users may not be familiar with the limitations of floating point numbers in PHP/MySQL, and this config field...
...can lead to confusion. There isn't enough explanation that:
Also, big +1 for this request to add a decimal fieldtype to the core, as for many needs a decimal type would be more appropriate, more intuitive and less confusing than a float type.