SQL Command to Insert Inf, NAN and -Inf into sqlite3 database

Viewed 995

What is the sql command to insert infinity, negative infinity, and not a number into a real type column in sqlite3 database tables?

i.e what would be in place of value1, value2?

INSERT INTO table (column1,column2 ,..)
VALUES( value1, value2 ,...);

I have tried finding resources for this on the sqlite3 documentation but was unable to find anything.

Inserting "Inf" and "-Inf" as a string and reading it in via C++ gives me a small -0.00... value

1 Answers

you can insert -Infinity or +Infinity into real datatype as well as NaN , etc as it has been mentioned in the documenation:

create table input (numbers real);
insert into input values ('-Infinity');
insert into input values ('+Infinity');

db<>fiddle here

but in your c , I think you have to handle it yourself , like when you see '+inf' or '+infinity'

Related