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

  • From: Edwin Yip <edwin.yip@xxxxxxxxxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 25 Feb 2009 20:50:08 +0800

Thank you Ralf, using the ROUND function solves the problem, it seems that
the max value for precession is 4, or the comparison will fail, I don't
understand why, would you explain on this? thank you.


Best Regards,
Edwin Yip

Mind Mapping is as Effortless as Typing
http://www.InnovationGear.com


On Wed, Feb 25, 2009 at 8:01 PM, Delphi Inspiration <delphi@xxxxxxxx> wrote:

> 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: