jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Mod4j: Modeling for Java using Domain Specific Languages
  • Mod4j: Modeling for Java using Domain Specific Languages
  • MODFORJ-9

The decimal type generated as float is not precise

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

The float data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead.

Now fi when the decimal value 9999.9999 is persisted, the retrieved value will be 10000.0.
This is not precise enough for systems that work with currencies.
===================

Eric Jan Malotaux [17/feb/09 11:29 AM] This is probably not a good reason to implement decimal with BigDecimal. Money should be modelled as a value type, with an integer for the value property, and an indicator for the precision. For example, whether the value mean whole currency values, e.g. euro's or dollars, or cents, or another position for the virtual decimal position. And a currency indicator, of course.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Eric Jan Malotaux made changes - 30/Jul/09 4:43 AM
Field Original Value New Value
Fix Version/s Wish List [ 15007 ]
Fix Version/s 1.1.0-beta-1 [ 15006 ]
Johan Vogelzang made changes - 19/Aug/11 7:14 AM
Assignee Johan Vogelzang [ jvogelzang ]
Johan Vogelzang made changes - 19/Aug/11 8:04 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.0 [ 16205 ]
Fix Version/s Wish List [ 15007 ]
Resolution Fixed [ 1 ]

People

  • Assignee:
    Johan Vogelzang
    Reporter:
    Jos Warmer
Vote (0)
Watch (0)

Dates

  • Created:
    19/Feb/09 8:06 AM
    Updated:
    19/Aug/11 8:04 AM
    Resolved:
    19/Aug/11 8:04 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.