On Aug 15, 2008, at 7:49 AM, Andreas Skowron wrote:
Hello,
I'm looking for help regarding variable data types in Jess.
In our company's project we're using Jess to calculate with money,
so floating-point calculations aren't really usable for us, because of
rounding issues.
Our idea was to use the BigDecimal class because it has all the
features
we need to calculate without loosing a penny.
Has anyone tried to use this (or a similar) class in Jess, or are
there
any examples for this case?
It should be pretty straightforward to use BigDecimal in Jess, just as
you'd use any other Java class.
(import java.math.BigDecimal)
(bind ?n (new BigDecimal "123.45"))
(bind ?s (?n add (new BigDecimal 10)))
((System.out) println ?s) ;; Prints "133.45"
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------