db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Newsham" <jnews...@referentia.com>
Subject RE: Is derby sql "real" equivalent to java "float"
Date Wed, 31 Oct 2007 23:45:37 GMT

Thanks for the pointer.  It turns out I overlooked this documentation.  I
was reading the pdf file, and only saw the overview of the data types, and
the assignability matrix.  

I guess I'll have to test my values for legal range before inserting into
the database.  It's unfortunate that there's a type range mismatch, though,
as it introduces an additional, potential cause of failure which I suspect
in most cases will not be expected or handled.  If there is no longer a good
reason for the mismatch, I too vote that it be removed.


> -----Original Message-----
> From: Dag.Wanvik@Sun.COM [mailto:Dag.Wanvik@Sun.COM]
> Sent: Wednesday, October 31, 2007 1:32 PM
> To: Derby Discussion
> Subject: Re: Is derby sql "real" equivalent to java "float"
> Jim Newsham <jnewsham@referentia.com> writes:
> > In the meantime, I'd like to ask.  Should Java float always be safely
> > settable to a field of Derby type REAL?  This has been my assumption all
> > along, and refderby.pdf seems to imply this.  Or, are there edge cases,
> such
> > as perhaps NaN which will cause the set operation to fail.
> The limits I mentioned in a previous post are actually documented:
> Quote from http://db.apache.org/derby/docs/dev/ref/rrefsqlj14122.html
> > REAL value ranges:
> >
> >     * Smallest REAL value: -3.402E+38
> >     * Largest REAL value: 3.402E+38
> >     * Smallest positive REAL value: 1.175E-37
> >     * Largest negative REAL value: -1.175E-37
> >
> > These limits are different from the java.lang.Float Java type limits.
> >
> > An exception is thrown when any double value is calculated or
> > entered that is outside of these value ranges.
> Thanks,
> Dag

View raw message