Re: Selecting tiny numbers with many significant digits returns NULL

[email protected] (Marius Feraru)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
Ken Marks <[email protected]> wrote:
> I wrote a simplified script that demonstrated the problem
You could simplify it even more:

use strict;
use warnings;
use DBI;
my $dbh = DBI->connect(...);
print $dbh->selectrow_array("select $_"), $/ for qw(
    2.775557561562E-17
    2.7755575615629E-17
);

Anyway, as expected, DBI doesn't seem to be the culprit, it returns
whatever the DB provides, which was never NULL in my tests (various
everything, but no ODBC/MSWindows, sorry).

> It seems that when the mantissa of a number has too many significant digits
> DBI returns a NULL instead of the number.
You can't be sure that's NULL/undef there, at least not until warnings
are enabled.
Try tracing DBI to see what's going on.

Good luck
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.