1

How to express the largest floating point value (for FLOAT8) in PostgreSQL?

I need it to replace 'Infinity'::FLOAT8 during conversion to jsonb field values, because json does not allow NaN and infinity values.

C++ has numeric_limits<double>::max(). Is there something equivalent in PostgreSQL?

(I'm using the latest PostgreSQL 11/12).

1

There is no constant for that in PostgreSQL, but if your architecture uses IEEE floating precision values, the maximum should be 1.7976931348623158e308.

Maybe it would be a good idea to use a value that's larger than any reasonable value, but obviously artificial, like 1e300.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.