PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
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, 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
> 
>      $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
endian).

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
-- 
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!