Jump to content

[SOLVED] Float field type problems more than 6 numbers


formulate
 Share

Recommended Posts

Created a new float field and it is converting any numbers past the 6th to zero. Example: I enter 123456789 in to the field and after saving the number is 123456000.

I have checked and ensured the character limit is set to it's default "10". I also tried "0" and "999". None of that worked.

PW version 3.0.184

SOLUTION: use the "Decimal" fieldtype that is built in to the core. It's not installed by default, you need to enable it in Modules > Core.

Edited by formulate
Marking solved.
Link to comment
Share on other sites

@formulate: per @ryan (see https://github.com/processwire/processwire-issues/issues/1502), "It's okay to change it to a double directly in the DB schema if you want to. I have done this on the rare occasion when it was helpful and it works just fine."

i.e. you can copy and hack the float fieldtype and make it type 'double' - if decimal doesn't fit your need . I'm still not sure why 'double' isn't provided out of the box.

Link to comment
Share on other sites

Ok, so this is getting over my head a bit. My numbers are not scientific notation, I just want a way in PW to be able to specify a 7 or 8 digit number, possibly with 2 decimal places and have it not manipulated in any way. I guess I could just use a text field, but that defeats the purpose.

Link to comment
Share on other sites

  • formulate changed the title to [SOLVED] Float field type problems more than 6 numbers
Just now, Jan Romero said:

+1 for installing Decimal by default and perhaps even making Float uninstalled by default.

Totally agree to this. I imagine most common case-use scenarios would be for using Decimal rather than Float. Given the additional confusion with Float and how the numbers get manipulated (which isn't readily clear anywhere that I could see), it definitely seems like Float should not be the default option that's installed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...