Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

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, wrote:
> Since I do not have any NaN in the database right now, I cannot test my code.
> Can I safely assume that a
>      $sth->"fetch"
> 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 / / / ZetaTools, Inc /
ZetaTools: Call perl functions as Sybase stored procedures!