You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "Dag H. Wanvik" <Da...@Sun.COM> on 2007/11/01 00:31:35 UTC
Re: Is derby sql "real" equivalent to java "float"
Jim Newsham <jn...@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
RE: Is derby sql "real" equivalent to java "float"
Posted by Jim Newsham <jn...@referentia.com>.
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.
Thanks,
Jim
> -----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 <jn...@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