Opened 4 years ago

Last modified 4 years ago

#32118 closed New feature

db.models.FloatField name misleading — at Initial Version

Reported by: Michael Owned by: nobody
Component: Database layer (models, ORM) Version: 3.1
Severity: Normal Keywords: Fields
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the DB world the difference between float (4 bytes) and double (8 bytes) is arguably common. However Django calls a double a float. I would imagine it would be very hard to add a DoubleField and make FloatField the normal 4 byte float due to legacy. Although not ideal how about adding a SmallFloatField or RealField some other name to allow users to create a 4 byte floats?

PostgresQL calls 4 byte float a real, and a 8 byte float a double precision
https://www.postgresql.org/docs/9.1/datatype-numeric.html

Mysql calls 4 byte float a float, and a 8 byte float a double
https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html

Note: People cite "space is cheap", but this is not always the case, and depending on the situation there are real practical savings.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top