I think Ruff, Jeff wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> The following statement worked in 6.0 and not it 6.1a4
> 
> (bind ?pos4-11 (format nil "%04d" (* (fetch TopPad) 0.001)))
> 
> Has anything changed? I can only find reference to adding the "n".
> Thanks in advance for your help.
> Jeff Ruff
> ChipData
> 

The format implementation was completely redone in Jess 6.1a2. The old
format had a lot of problems, and this new one is both better and more
standards-compliant. It's based on some public-domain code from Sun.

The error message that you get from the above is something like:

  Jess reported an error in routine format
        while executing (format nil "%04d" (* (fetch TopPad) 1.0E-4)).
  Message: Bad format string %04d.
  Program text: ( format nil "%04d" ( * (fetch TopPad) 1.0E-4 ) )  at line 1.
  Nested exception is:
  Cannot format a double with a format using a d conversion character.

The last line of the message is a fairly clear explanation: "d" is a
format conversion character for integers, not floats. If you use "d"
to print a double in the C language, you'll get garbage. Jess is just
making this explicit.

If you want to print the number as an integer in a four-digit field,
then convert it to an integer using the (integer) function first:

(format nil "%04d" (integer ( * (fetch TopPad) 1.0E-4)))



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

Reply via email to