I think Ruff, Jeff wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> The code at the end of the email reads in a string with a length of 2
> items. As shown below the string is two numbers with three decimal
> places.
> 
> String passed to JESS is 2.000 2.100
> 
> But trailing zeros are removed as shown in the output from the explode$
> Function
> 
> Found a Max Min Value condition(2.0 2.1)
> 
> In this case the number of decimal places is important and I try later
> to find how many places in the original to set the format of the output.
> Is this a normal behavior? If so what can I do to preserve the number of
> decimal places.
> 

explode$ converts a string into Jess objects as if it were parsing
code; it turns floating point numbers into Jess "FLOAT"s, which are
internally just Java doubles. A Java double doesn't have this notion
of a fixed number of trailing zeroes (that's why they're
floating-point, not fixed-point.) So you can't really do this with
doubles in either Java or Jess. 

What you'd have to do instead is keep them as Strings most of the
time. You can do that by double-quoting them -- i,e.,

Jess> (explode$ "\"2.000\" \"2.00\" \"2.0\"")
("2.000" "2.00" "2.0")

Note that Jess auto-converts Strings to numbers when it has to --
i.e.,

Jess> (+ "2.0" 3)
5




---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to