You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Michelle Caisse <Mi...@Sun.COM> on 2005/05/17 20:26:59 UTC
FieldsOfDouble problem
TestFieldsOfDouble fails because the test attempts to persist values of
Double.MIN_VALUE and Double.MAX_VALUE and the Derby double datatype has
narrower limits:
"DOUBLE value ranges:
* Smallest DOUBLE value: -1.79769E+308
* Largest DOUBLE value: 1.79769E+308
* Smallest positive DOUBLE value: 2.225E-307
* Largest negative DOUBLE value: -2.225E-307
These limits are different from the java.lang.DoubleJava type limits."
Any suggestions on how to handle this?
-- Michelle
Re: FieldsOfDouble problem
Posted by Michael Bouschen <mb...@spree.de>.
Hi Michelle, Hi Craig,
I recall we had a similar issue with the TCK 1.0.1.
I think the test case does not really require the values
Double.MIN_VALUE and Double.MAX_VALUE. So maybe we can use different
double values for the test.
Regards Michael
> TestFieldsOfDouble fails because the test attempts to persist values
> of Double.MIN_VALUE and Double.MAX_VALUE and the Derby double
> datatype has narrower limits:
>
> "DOUBLE value ranges:
>
> * Smallest DOUBLE value: -1.79769E+308
> * Largest DOUBLE value: 1.79769E+308
> * Smallest positive DOUBLE value: 2.225E-307
> * Largest negative DOUBLE value: -2.225E-307
>
> These limits are different from the java.lang.DoubleJava type limits."
>
> Any suggestions on how to handle this?
>
> -- Michelle
>
--
Michael Bouschen Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin
Re: FieldsOfDouble problem
Posted by Michelle Caisse <Mi...@Sun.COM>.
I've created JIRA issue JDO-50 for this.
-- Michelle
Niclas Hedhman wrote:
>On Wednesday 18 May 2005 06:01, Craig Russell wrote:
>
>
>
>>We decided to use these values for double in the AllTypes class:
>> public static final double DOUBLE_SMALLEST = -9999999999999.9;
>> public static final double DOUBLE_LARGEST = 9999999999999.9;
>> public static final double[] double_values =
>> { DOUBLE_SMALLEST, DOUBLE_LARGEST, 0.0, 100.0, 100.0,
>> 50000000.0, -234234.234, 1000000000.0, 350.5, -25.5 };
>>
>>I'd be happy to use DOUBLE_LARGEST and DOUBLE_SMALLEST from AllTypes.
>>
>>What do you all think?
>>
>>
>
>May I suggest that 0.1 and -0.1 are included in the suite of numbers??
>Over the years, they have been involved in a lot of rounding issues (granted;
>because people errenously use floats and doubles for monetary and other
>fixed-point decimal numbers) and I would be happy if the expected behaviour
>is "documented" in tests.
>
>
>Cheers
>Niclas
>
>
Re: FieldsOfDouble problem
Posted by Craig Russell <Cr...@Sun.COM>.
Hi Niclas,
Your idea seems reasonable. I believe we already have a rounding
algorithm in the tests, so putting in some explicit known tricky cases
would be a good test.
Craig
On May 17, 2005, at 10:37 PM, Niclas Hedhman wrote:
> On Wednesday 18 May 2005 06:01, Craig Russell wrote:
>
>> We decided to use these values for double in the AllTypes class:
>> public static final double DOUBLE_SMALLEST = -9999999999999.9;
>> public static final double DOUBLE_LARGEST = 9999999999999.9;
>> public static final double[] double_values =
>> { DOUBLE_SMALLEST, DOUBLE_LARGEST, 0.0, 100.0, 100.0,
>> 50000000.0, -234234.234, 1000000000.0, 350.5, -25.5 };
>>
>> I'd be happy to use DOUBLE_LARGEST and DOUBLE_SMALLEST from AllTypes.
>>
>> What do you all think?
>
> May I suggest that 0.1 and -0.1 are included in the suite of numbers??
> Over the years, they have been involved in a lot of rounding issues
> (granted;
> because people errenously use floats and doubles for monetary and other
> fixed-point decimal numbers) and I would be happy if the expected
> behaviour
> is "documented" in tests.
>
>
> Cheers
> Niclas
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
Re: FieldsOfDouble problem
Posted by Niclas Hedhman <ni...@apache.org>.
On Wednesday 18 May 2005 06:01, Craig Russell wrote:
> We decided to use these values for double in the AllTypes class:
> public static final double DOUBLE_SMALLEST = -9999999999999.9;
> public static final double DOUBLE_LARGEST = 9999999999999.9;
> public static final double[] double_values =
> { DOUBLE_SMALLEST, DOUBLE_LARGEST, 0.0, 100.0, 100.0,
> 50000000.0, -234234.234, 1000000000.0, 350.5, -25.5 };
>
> I'd be happy to use DOUBLE_LARGEST and DOUBLE_SMALLEST from AllTypes.
>
> What do you all think?
May I suggest that 0.1 and -0.1 are included in the suite of numbers??
Over the years, they have been involved in a lot of rounding issues (granted;
because people errenously use floats and doubles for monetary and other
fixed-point decimal numbers) and I would be happy if the expected behaviour
is "documented" in tests.
Cheers
Niclas
Re: FieldsOfDouble problem
Posted by Craig Russell <Cr...@Sun.COM>.
Hi Michelle,
We should not use Double.MIN_VALUE and MAX_VALUE in TCK tests. I had
changed a number of these to fix a similar bug last year, but
apparently overlooked this class.
We decided to use these values for double in the AllTypes class:
public static final double DOUBLE_SMALLEST = -9999999999999.9;
public static final double DOUBLE_LARGEST = 9999999999999.9;
public static final double[] double_values =
{ DOUBLE_SMALLEST, DOUBLE_LARGEST, 0.0, 100.0, 100.0,
50000000.0, -234234.234, 1000000000.0, 350.5, -25.5 };
I'd be happy to use DOUBLE_LARGEST and DOUBLE_SMALLEST from AllTypes.
What do you all think?
Craig
On May 17, 2005, at 11:26 AM, Michelle Caisse wrote:
> TestFieldsOfDouble fails because the test attempts to persist values
> of Double.MIN_VALUE and Double.MAX_VALUE and the Derby double
> datatype has narrower limits:
>
> "DOUBLE value ranges:
>
> * Smallest DOUBLE value: -1.79769E+308
> * Largest DOUBLE value: 1.79769E+308
> * Smallest positive DOUBLE value: 2.225E-307
> * Largest negative DOUBLE value: -2.225E-307
>
> These limits are different from the java.lang.DoubleJava type limits."
>
> Any suggestions on how to handle this?
>
> -- Michelle
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
Re: FieldsOfDouble problem
Posted by er...@jpox.org.
Michelle,
You can use DECIMAL or NUMERIC types.
<column sql-type="DECIMAL" scale precision length/>
Quoting Michelle Caisse <Mi...@Sun.COM>:
> TestFieldsOfDouble fails because the test attempts to persist values of
> Double.MIN_VALUE and Double.MAX_VALUE and the Derby double datatype has
> narrower limits:
>
> "DOUBLE value ranges:
>
> * Smallest DOUBLE value: -1.79769E+308
> * Largest DOUBLE value: 1.79769E+308
> * Smallest positive DOUBLE value: 2.225E-307
> * Largest negative DOUBLE value: -2.225E-307
>
> These limits are different from the java.lang.DoubleJava type limits."
>
> Any suggestions on how to handle this?
>
> -- Michelle
>