Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BigDecimal - am I missing something obvious?

 
Dorcas Rebanha
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code:

BigDecimal smallPercent = new BigDecimal (20.2);
EquipmentContributionDeclaration anEquiContDecl =
new EquipmentContributionDeclaration();
anEquiContDecl.setContributionPercentage(smallPercent);
System.out.println(anEquiContDecl.getContributionPercentage().toString());

Where contributionPercentage is an attribute of type BigDecimal in the EquipmentContributionDeclaration class.

It seems like the getter and setter should work in the usual way, but the result of the println is 0. Just plain 0.

Is there something mysterious or esoteric about BigDecimal that I am missing?

Thanks.

Dorcas
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dorcas Rebanha:
It seems like the getter and setter should work in the usual way
You would think so. But the mystery is more likely to be in the details of the getter and setter. Have a look there first.
 
Dorcas Rebanha
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Others on my team narrowed it down to a mysterious problem with the setter. It's not my job to pursue that problem, but others will do so.

Dorcas
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic