Is there a way to obtain 'NaN' using only numbers? PostgreSQL can contains NaN (not a number) value in numeric and float columns and variables: https://www.postgresql.org/docs/current/static/datatype-numeric.html#DATATYPE-FLOAT

https://dbfiddle.uk/?rdbms=postgres_10&amp;fiddle=1fdf20510b1b6a1416754599c60fc93f

Is there a way to obtain NaN different of inserting or updating directy to such value?

In this question I considered that all of these are the same:

insert into t (v) values ('NaN');
insert into t (v) values ('N'||'a'||'N');
insert into t (v) values (E'\116\101\116');
insert into t (v) values (chr(78)||chr(65)||chr(78));
update t set v='NaN';


I try things like:

insert into numeros (id, n1, n2) values (5, 1e306/1e-306, 1e306/1e-306); -- not representable
insert into numeros (id, n1, n2) values (6, 0/0, 1/0);  -- division by 0
divide infinity by infinity.

jasen=# select cot(0)/cot(0);
 ?column? 
----------
      NaN