Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: NaN
Date: Aug 2 2002 3:23PM
On Fri, 2002-08-02 at 06:22, Matthew.Persico@Lazard.com wrote:
> Since I do not have any NaN in the database right now, I cannot test my code.
> Can I safely assume that a
> will return the text 'NaN' in any field that had that value? Of do I have to
> look for some crazy number?
Hmmm - that is a really good question!
The DBD::Sybase code will leave a FLOAT/REAL number as a number. It
determines that something it fetched is a number based on the column's
datatype, not on the actual data.
According to my linux include files a NaN value is endian dependant, and
is either 0x7f, 0xc0, 0, 0 (big endian) or 0, 0, 0xc0, 0c7f (little
You could try forcing an insert with such a value (using pack() to
generate it) and then fetch it to see what happens.
DBD::Sybase itself doesn't do anything, but perl may automagically
convert NaN values to "NaN" when you print them.
Michael Peppler / firstname.lastname@example.org / http://www.mbay.net/~mpeppler
email@example.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!