Hi,
We are calculating some pricing information based on Jess rules and some
times the results are little fuzzy!
e.g.
(- 1.1 0.9) == 0.20007
(- 1.1 0.7) == 0.40013
Any idea what the reason is or how can I fix it other than to round-off in
the application.
I have tested
This is not a Jess problem.
Using reals for non-atomic monetary units (e.g., dollar, euro, pound) is
a no-no. Absolutely. Don't do it.
You might turn to integers representing the subunit (e.g., cent or penny
or whatever). Or use java.math.BigDecimal.
Kind regards
Wolfgang
Nara Hari wrote:
(- 1.1 0.9) == 0.20007
(- 1.1 0.7) == 0.40013
Any idea what the reason is or how can I fix it other than to round-
off in
the application.
This is a general property of the floating-point number system used
in Java (and many other languages); see, for example,
Hi Ernest,
Thanks for doc reference. I just realized that Java also returns the same
numbers.
I will use Wolfgang's tip.
Regards.
Ernest Friedman-Hill wrote:
(- 1.1 0.9) == 0.20007
(- 1.1 0.7) == 0.40013
Any idea what the reason is or how can I fix it other