Changeset 514 for cpp


Ignore:
Timestamp:
05/23/16 13:53:25 (9 years ago)
Author:
Maciej Komosinski
Message:

More strict parsing of numbers when converting genotypes f1->f0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/f1/conv_f1.cpp

    r375 r514  
    431431if (isdigit(begin[0]) || (begin[0]=='-'))
    432432        {
    433         double weight=atof(colon+1);
    434         int relative=atoi(begin);
     433        double weight=ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str());
     434        paInt relative=ExtValue::getInt(trim(SString(begin,colon-begin)).c_str(),false);
    435435        int this_refno=neuro_f1_to_f0.size()-1;
    436436        addOrRememberInput(this_refno,this_refno+relative,weight);
     
    452452                else if (cls->getPreferredLocation()==1) receptor->attachToPart(getLastPart());
    453453                }
    454         last_f1_neuro->addInput(receptor,atof(colon+1));
     454        last_f1_neuro->addInput(receptor,ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str()));
    455455        if (usemapping) receptor->addMapping(*makeRange(begin,end-1));
    456456        }
     
    458458        {
    459459        Neuro *out=model.addNewNeuro();
    460         out->addInput(last_f1_neuro,atof(colon+1));
     460        out->addInput(last_f1_neuro,ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str()));
    461461        out->setClassName(SString(begin+1,end-colon-1));
    462462        if (begin[1]=='@')
     
    478478        if (usemapping) out->addMapping(*makeRange(begin,end-1));
    479479        }
    480 else if (*begin=='!') addClassParam("fo",atof(colon+1));
    481 else if (*begin=='=') addClassParam("in",atof(colon+1));
    482 else if (*begin=='/') addClassParam("si",atof(colon+1));
     480else if (*begin=='!') addClassParam("fo",ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str()));
     481else if (*begin=='=') addClassParam("in",ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str()));
     482else if (*begin=='/') addClassParam("si",ExtValue::getDouble(trim(SString(colon+1,end-(colon+1))).c_str()));
    483483else if (islower(begin[0]))
    484484        {
Note: See TracChangeset for help on using the changeset viewer.