Hi Rob,
It's not that Jess is "rounding off" the number, it's just that Jess
has only two numeric types: INTEGER (a 32-bit Java int) and FLOAT (a
64-bit Java double). Yes, yes, I know, Jess has some support for a
LONG type, but it's the crazy aunt locked in the attic -- it's not
quite right and we try not to talk about it. Look for improvements
in the handling of longs in the future.
Anyway, if the value is too big to be an INTEGER, it's a FLOAT, and
that's what's happening here. The largest possible INTEGER is
2147483647, a lot smaller than 123456789012, so Jess has to store you
number as a FLOAT.
If you want to store the number as a string, that's easy: just use
double quotes around it, and it's a string, not a number.
Now, if you want to store the number as a long, you can do that too --
but then you still can't do much to it in the way of math or
anything. Use the "long" function and pass the number in as a string
literal to create a LONG.
I think Rob Wheeler wrote:
> Hi All,
>
> Consider the following code fragment:
>
> Jess> (deftemplate foo (slot bar) (slot baz))
> TRUE
> Jess> (assert (foo (bar 1) (baz 123456789012)))
> <Fact-0>
> Jess> (facts)
> f-0 (foo (bar 1) (baz 1.23456789012E11))
> For a total of 1 facts.
> Jess>
>
> How do I stop Jess from rounding the value of baz?
>
> If possible, can I get Jess to treat all slot values as Strings?
>
> cheers
> Rob.
> --
> British Maritime Technology
> Tel: +44 (0)20 8943 5544
> Fax: +44 (0)20 8977 9304
> WWW: http://www.bmtech.co.uk
>
> IMPORTANT: Any views or opinions expressed are solely those of the author
> and do not necessarily represent those of British Maritime Technology.
>
>
>
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------