[yunqa.de] Re: Rounding of REAL and DISQLite3Api.DateTimeToJulianDate

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 25 Feb 2009 13:01:25 +0100

Edwin Yip wrote:

>The problem is that  the above select statement does not return any records, I 
>think this is because of the difference after rounding (calling of 
>DateTimeToJulianDate), but I HAVE use this datetime value to match the 
>records, it's of the the combined primary keys. Any suggestion to solve my 
>problem? Thank you.

Precision is an inherited problem in floating point arithmetic. See

  http://en.wikipedia.org/wiki/Floating_point

Therefore the recommendation is not to use double / floating point types for 
exact record matches. If you must do so, consider using ROUND(number, 
precision) on both sides of the comparison to compensate for rounding errors or 
compare against a range of values to satisfy for potential rounding errors.

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: