Apache JDO Project - FieldsOfDouble problem

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > June 2005 > FieldsOfDouble problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FieldsOfDouble problem
Michelle Caisse

2005-06-06, 7:49 am

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

erik@jpox.org

2005-06-06, 7:49 am

Michelle,

You can use DECIMAL or NUMERIC types.

<column sql-type="DECIMAL" scale precision length/>

Quoting Michelle Caisse <Michelle.Caisse@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
>





Craig Russell

2005-06-06, 7:49 am

Michael Bouschen

2005-06-06, 7:49 am

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


Niclas Hedhman

2005-06-06, 7:49 am

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

2005-06-06, 7:49 am

Michelle Caisse

2005-06-06, 7:49 am

I've created JIRA issue JDO-50 for this.

-- Michelle

Niclas Hedhman wrote:

>On Wednesday 18 May 2005 06:01, Craig Russell wrote:
>
>
>
>
>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
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com