Subject Re: float vs double precision
Author bwc3068
that did it.

thanks
kelly

--- In firebird-support@yahoogroups.com, "bwc3068" <avert@...> wrote:
>
>
> Sounds like i need to change the "float" to "double precision" in the SQL that generates the table then?
>
>
> --- In firebird-support@yahoogroups.com, Geoff Worboys <geoff@> wrote:
> >
> > Hi Kelly,
> >
> > > IF I input "1.23" into the Double Precision field and then
> > > tab off of it, it reads: 1.23.
> >
> > > If I input "1.23" into the Float field and then tab off of
> > > it, it reads:
> > > 1.23000001907349
> >
> > > Any idea why the "float" field display incorrectly after the
> > > value get's placed into the query?
> >
> > The reason is fairly simple - Delphi is not very good with
> > single ("float") data types. Many of it's function are not
> > overloaded to single (or even double), instead the value is
> > automatically cast up to extended with its supposed 18+
> > digits of significance.
> >
> > FloatToStr is one such example, math.RoundTo and math.
> > SimpleRoundTo are additional examples (as are RoundNear etc
> > supplied with IBO).
> >
> > NOTE: Beware of math.SimpleRoundTo - I recently discovered
> > that the implementation changed sometime between Delphi6 and
> > Delphi2010 and it is no longer asymmetric as described in the
> > supplied help files. I've written to Embarcadero but have
> > not received any response.
> >
> > You can work around the problem by implement specific to-str
> > conversions that limit the output digits (which is usually a
> > good idea anyway) but it is very difficult to prevent unwanted
> > surprises arising from the use of single-precision fp.
> >
> >
> > My conclusion, from back in Delphi5 days and not changed since,
> > is that the float/single data-type, which is never very useful,
> > is pretty close to completely useless in Delphi. As a result
> > things like percentages, which technically only "needed" float
> > I have implemented as double anyway.
> >
> > --
> > Geoff Worboys
> > Telesis Computing
> >
>