Last answered:

10 Mar 2023

Posted on:

09 Mar 2023


Resolved: float and double

I don't quite understand the difference between float and double. I come across float4 and float8 and I really don't understand when to use which?

1 answers ( 1 marked as helpful)
Posted on:

10 Mar 2023


Hi Salma!
Thanks for reaching out.

The choice between using FLOAT() and DOUBLE() is about how many bytes will be used to store the data from the given field. FLOAT() requires 4 bytes (i.e., you'd opt for FLOAT() if 4 bytes would suffice), and DOUBLE() will require 8 bytes. In other words, more bytes used in the memory, the more symbols you can use to represent the numeric values from that field.

A synonym for float4 is real. Synonyms for float are float8 and double precision. 

Hope this helps.

Submit an answer