This is not a really important bug but it should be fixed and might be the symptom of something else.
On a form with a dataprovider wich is a number called “num” and a value of 22.77.
- I change the value to 22.88 (the value is not important as long as the number has decimals)
- Press a button that do the following in a method:
plugins.dialogs.showInfoDialog( “”, "The value is: "+num,“OK”);
The dialog will show: “The value is: 22.8799991607666”
I’ve reproduced the bug on Oracle9i but not in MySQL.
yes this is because of the float nature of numbers.
If you create a numeric value on the database like this:
numeric(10,2) what is the value then (then the db only stores 2 digits)
I’ve tried with numeric(10,2) and number(10,2) and I’ve got the same error with many more decimals that 2.
what do you exactly see if you look at the data from a database tool?
Are only 2 digits inserted?
in java we convert it to double so if the number doesn’t fit, we still have a problem. Setting a format for that number is then the only cure.
This time I’ve entered 22.22 and then changed it to 22.23 and only 2 digits are inserted in Oracle9i (even in a field defined as NUMBER(30,6) which allows more digits)
I guess that this is not a problem of the dataprovider but a problem during the cast to String.
NEWS: with the repository in MySQL I can reproduce the bug but the prodecure is a bit different: I don’t have to modify the value, just push the button to show the dialog. If I enter into the field and then push the button everything works correctly.
To reproduce the bug after putting the focus in the field I have to click on the Designer button on the toolbar twice and push the button that shows the dialog again.
this seems to be fixed in rc2