Page 1 of 1

NaN - not a Number

Posted: Thu 08 Mar 2012 08:32
by ralle1
Hello!

we've got the following problem:

We use an IBCQuery with ReadOnly=false (formaly RequestLive) to update a table-row in a Firebird Database (2.1 or 2.5). There is a column with type "double precesion" which contains a NaN-Value.

The update fails with an exception at the post-command because the update-statemant generated from IBCQuery is invalid in the Where-clause because of the NaN-Value.

We took a look at the sourcecode in unit MemData. The exception occurs in TMemData.CompareFieldValue when calling BitConverter.Int64BitsToDouble.

Is it possible to fix the problem at this position by checking the value for NaN (or Infinity) or can you tell us an other solution?

Thank you for your help.

Greetings

Posted: Mon 12 Mar 2012 11:23
by AndreyZ
Hello,

The point is that Firebird doesn't support NaN values. For more information, please refer to the following bugs on the Firebird's tracker:
http://tracker.firebirdsql.org/browse/CORE-2160
http://tracker.firebirdsql.org/browse/CORE-2505
http://tracker.firebirdsql.org/browse/CORE-2581
http://tracker.firebirdsql.org/browse/CORE-2582
To solve the problem, you should update your DOUBLE PRECISION fields and set the Null value instead of NaN to them. Please contact the Firebird developers and ask about a correct way of doing it.