Bug 855871 - Imprecise number results in Pet Store example
Summary: Imprecise number results in Pet Store example
Keywords:
Status: NEW
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: Examples
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-10 13:20 UTC by jgargula
Modified: 2023-05-01 08:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description jgargula 2012-09-10 13:20:27 UTC
Description of problem:
Pet store example application should present the use of Drools in business world and every ordinary calculator is able to calculate 90 or 95 percent of some number exactly. Hence, it is not a good advertisement if Drools are presenting results in form of 18.900000000000002 or 11.399999999999999 in case that these numbers should be exact 18.9 and 11.4.

Version-Release number of selected component (if applicable):
BRMS 5.3.0.GA

How reproducible:
Follow next steps.

Steps to Reproduce:
1. Run examples by runExamples.sh script and then start PetStoreExample.
2. Click 2x on "Gold Fish" and 1x on "Fish Food" and press "Checkout" and "Yes"
3. You will get discounted total 11.399999999999999
4. Press "Reset" button
5. Press 3x on "Gold Fish" and 3x on "Fish Food" and press "Checkout" and "Yes"
6. You will get discounted total 18.900000000000002
  
Actual results:
Imprecise results (11.399999999999999 and 18.900000000000002)

Expected results:
Mathematically exact results (11.4 and 18.9)

Additional info:
I suppose that this is a problem of type double and rather BigDecimal should be used .


Note You need to log in before you can comment on or make changes to this bug.