Re: [sqlite] Rrepresentation of REAL type - answered!

2014-09-20 Thread TimeOfDay.nl
Adminer sets the precision 
 directive.

That's the correct answer. So it is PHP itself thats rounds to 14 decimals,
as defined in php.ini.  Adminer overrides it.

On Sat, Sep 20, 2014 at 4:37 AM, Richard Hipp  wrote:

> On Fri, Sep 19, 2014 at 11:46 AM, TimeOfDay.nl 
> wrote:
>
> > I am looking at my SQLite database in two ways:
> >
> > 1. from PHP, in my application,  thru 'select * from table' statements
> and
> > the such
> > 2. from Adminer, as a database management tool
> >
> > When I look at a field that is type Real, and has the value of -41.29 as
> > the entered value, the results differ.
> >
> > - The PHP select gives me -41.29
> > - Adminer gives me -41.289147
> >
> > Why this difference?  Does the php library do something to 'round'
> numbers
> > to so-many decimals?
> >
>
>
> See http://www.sqlite.org/faq.html#q16
>
> The think to remember is that IEEE floating point numbers are
> approximations.  They are designed to solve real world physic problems.
> And in the real world it is pysically impossible to tell -41.29 and
> -41.289147 apart.  So you might as well think of them as the
> same number.
>
> A 64-bit IEEE floating point number variable cannot, in fact, contain
> exactly -41.29.  The closest it can get is
> -41.28914734871708787977695465087890625.  SQLite doesn't even
> try to get that close - promising only that floating point value are
> correct to 15 significant digits.
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
TimeOfDay web services | timeofday.nl | +31 (0)68 198 6848
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Rrepresentation of REAL type

2014-09-19 Thread Richard Hipp
On Fri, Sep 19, 2014 at 11:46 AM, TimeOfDay.nl 
wrote:

> I am looking at my SQLite database in two ways:
>
> 1. from PHP, in my application,  thru 'select * from table' statements and
> the such
> 2. from Adminer, as a database management tool
>
> When I look at a field that is type Real, and has the value of -41.29 as
> the entered value, the results differ.
>
> - The PHP select gives me -41.29
> - Adminer gives me -41.289147
>
> Why this difference?  Does the php library do something to 'round' numbers
> to so-many decimals?
>


See http://www.sqlite.org/faq.html#q16

The think to remember is that IEEE floating point numbers are
approximations.  They are designed to solve real world physic problems.
And in the real world it is pysically impossible to tell -41.29 and
-41.289147 apart.  So you might as well think of them as the
same number.

A 64-bit IEEE floating point number variable cannot, in fact, contain
exactly -41.29.  The closest it can get is
-41.28914734871708787977695465087890625.  SQLite doesn't even
try to get that close - promising only that floating point value are
correct to 15 significant digits.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Rrepresentation of REAL type

2014-09-19 Thread TimeOfDay.nl
I am looking at my SQLite database in two ways:

1. from PHP, in my application,  thru 'select * from table' statements and
the such
2. from Adminer, as a database management tool

When I look at a field that is type Real, and has the value of -41.29 as
the entered value, the results differ.

- The PHP select gives me -41.29
- Adminer gives me -41.289147

Why this difference?  Does the php library do something to 'round' numbers
to so-many decimals?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users