Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#415 Editing double field adds extra decimals

2.2final
open
Colin Bell
Core (461)
5
2012-12-29
2006-08-15
Jeff Moody
No

I'm using a Derby database.
When trying to manually edit a field that is created as
a float, it isn't quite working correctly.
Steps to reproduce:
1. Connect to the db
2. Select a table (in the "Objects" tab) with a field
that is created as a float and has at least 1 record in it
3. Select the Content tab
4. Right click on the viewed table, select "Make Editable"
5. Edit the value of a float field, entering 0.1
6. Select a different table
7. Select the table that was just edited

Notice that the value edited is now 0.10000000149011612.

I would suspect this is related to the way Java handles
converting from float to double. I.e. if you declare a
variable as a float, then cast to a double, the number
may change.
Consider the following code:
float f = 0.1f;
double d = f;

At this point:
d = 0.10000000149011612

I'm using Java 1.4.2_11

Discussion