I use clipsmm for integration CLIPS with Qt-application. I assert fact this way:
CLIPS::Fact::pointer fact;
QString fact_str = "(test (slot1 15) (slot2 4.3))";
fact = env.assert_fact(Std(fact_str)); //Std() translates QString into std::string
This fact is added to agenda, but slot2 has value = 4.0 instead 4.3:
At the moment the solution is:
"I did not quite figure it out, but the following helped: change the number formatting in the locale settings of the operating system. By default "ru_Ru" was used, in which "," is used to separate decimal places. I changed it to "ba_Ru" (only for "Detailed settings-> Numbers"), and values of float type became correct in my expert system. But now I have some problems with opening files, which include cyrillic. I had to rename some folders and files."
If somebody knows more neat solution, please, write it here or on the StackOverflow.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I have a problem with slot of float type. There is a template in my knowledge-base file:
(deftemplate test
(slot slot1 (type INTEGER) (default 10))
(slot slot2 (type FLOAT) (default 4.0))
)
I use clipsmm for integration CLIPS with Qt-application. I assert fact this way:
CLIPS::Fact::pointer fact;
QString fact_str = "(test (slot1 15) (slot2 4.3))";
fact = env.assert_fact(Std(fact_str)); //Std() translates QString into std::string
This fact is added to agenda, but slot2 has value = 4.0 instead 4.3:
<== Activation 0 start:
<== f-0 (initial-fact)
:== ?answer ==> 0 <== 0 //this is global
==> Activation 0 start:
==> f-0 (initial-fact)
Start!
==> f-1 (test (slot1 15) (slot2 4.0))
If I use "XCLIPS Expert System" all is good and slot2 has value = 4.3. What do I do wrong?
I posted this question also on the StackOverflow: http://stackoverflow.com/questions/42946163/clips-clipsmm-slot-of-float-type
At the moment the solution is:
"I did not quite figure it out, but the following helped: change the number formatting in the locale settings of the operating system. By default "ru_Ru" was used, in which "," is used to separate decimal places. I changed it to "ba_Ru" (only for "Detailed settings-> Numbers"), and values of float type became correct in my expert system. But now I have some problems with opening files, which include cyrillic. I had to rename some folders and files."
If somebody knows more neat solution, please, write it here or on the StackOverflow.