SQLite (.NET), 8 bytes double is converted to 'infinity' rather than double.MaxDouble as inserted?

181 Views Asked by At

I am using the SQLite .NET library to save doubles

This is my pseudo-code

// create table t1 (value REAL)
// ... connect to db
var sql = $"insert into t1(value) VALUES ({double.MaxValue:G64})"; // insert into t1(value) VALUES (1.7976931348623157E+308)
using (var command = new SQLiteCommand(sql, con))
{
  command.ExecuteNonQuery();
}

Then I do a select:

// SELECT * FROM t1
// .. connect + query
var d = reader.GetDouble(0);

But the value of d is double.PositiveInfinity rather than double.MaxValue, what could be the reason for the difference?

0

There are 0 best solutions below