0

I can find ways to get the smallest possible floating point value in other languages (examples: C++, Python), but how can I do this in PostgreSQL? Like something with a negative exponent in the hundreds. Something that is so negligible that it can be "effectively 0" without actually being 0, and can be achieved with a single line.

wfgeo
  • 2,716
  • 4
  • 30
  • 51
  • Read the [documentation](https://www.postgresql.org/docs/9.3/datatype-numeric.html) covering the range and precision of real/double types. – Tim Biegeleisen Apr 27 '19 at 15:17
  • @TimBiegeleisen That seems to just add to my confusion. That documentation states: "The double precision type typically has a range of around 1E-307 to 1E+308 with a precision of at least 15 digits". But I am able to (with a hardcoded value) select a value as low as 1e-323. I was hoping there may be a statement that can just select the absolute floor that is safely possible in the given environment. – wfgeo Apr 27 '19 at 15:20
  • You might want to expound on why you need to do this. Keep in mind that floating point storage is not exact to begin with. The really number you are seeking could easily just be the error in precision from some other calculation. – Tim Biegeleisen Apr 27 '19 at 15:22
  • I was hoping to avoid going into the details on why I need to do it because it goes very deeply into an experimental and academic topological data model that is rather explicit about every single aspect, and it can result in some "hypothetical" links that exist between other "real" links purely for the sake of modelling absolutely explicit connectivity in all directions. I realize this may be confusing to imagine why you would need to do this and to be honest it is probably a weakness of the data model itself. But the feasibility of the data model is kind if what I am investigating. – wfgeo Apr 27 '19 at 15:27
  • 1
    Then perhaps you should consider using an exact storage type, such as `NUMERIC`. – Tim Biegeleisen Apr 27 '19 at 15:28
  • After reading about the differences I think that is probably wise, thanks. – wfgeo Apr 27 '19 at 15:34

0 Answers0