jess-users  

JESS: Rounding a float number

ANA TANASESCU
Sun, 29 Nov 2009 07:19:29 -0800

Hello everyone,

I have a fact that contains a float slot. The value for this slot is obtain by 
calculations.
Is there in Jess a function that rounds the float number to a specified number 
of decimal. I have searched into the Jess functions library and I found the 
round function, but it returns an integer number not a float number.
I  have, also, found the function format that uses the format specificators 
from C++ like this:
(bind ?a 9)
(bind ?b (/ ?a 13))
(printout t ?b )
(format t "%2.2f" ?b)

Instead of this I want that the value of the variable ?b to be converted to a 
number.

Best regards,
Ana