Menu

slot of float type

Zoya
2017-03-21
2017-03-21
  • Zoya

    Zoya - 2017-03-21

    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?

     
  • Zoya

    Zoya - 2017-03-31

    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.

     

Log in to post a comment.