Isn’t this a problem out of our reach? Doubles are known to be not that accurate. Try to use a BigDecimal instead

 

Tom

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner
Sent: Saturday, July 29, 2006 14:32
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem handling Double values

 

hmm thats odd i do see it now in our own FormInput example for the double field.

will investigate that.

johan

On 7/29/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote:

Hi,
Thank you for your reply.
Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database.
But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1.9999 and then pressed Save button, it shows 2 in the textbox.

Thank you.

Md. kamruzzaman

 

On 7/29/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:

The problem is not with code you've shown. It must be something else.
The value in the database is correct. When you read the data from the
database is it stored in a Double as well?

Juergen

On 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED]> wrote:
>
>
>  Hi,
>  I'm having great problem with handling Double values in the text box. When
> I am entering a double value in a text box with more than 3 precisions like
> 1.999999 or 1.9999, it is being saved in the database accurately,  but the
> post back value showing in the text box is rounded to next Integer (in case
> of 1.999999 or 1.9999 it is showing 2).
>
> My sample code is given below:
>
> add(new RequiredTextField("amount", Double.class));
>
>
> Looking forward to have a good solution from you.
>
>
> --Md. Kamruzzaman
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to