Changeset 10252:ec524648dbaa in orange


Ignore:
Timestamp:
02/15/12 16:16:42 (2 years ago)
Author:
ales_erjavec
Branch:
default
Message:

A workaround for a strange behavior of 'operator >>' for floats (on Mac OSX gcc 4.2.1). Fixes #1104.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/tdidt_simple.cpp

    r10206 r10252  
    785785    int i; 
    786786    string lbracket, rbracket; 
     787    string split_string; 
    787788    SimpleTreeNode *node; 
     789 
     790    ss.exceptions(istream::failbit); 
    788791 
    789792    ASSERT(node = (SimpleTreeNode *)malloc(sizeof *node)); 
    790793    ss >> lbracket >> node->type >> node->children_size; 
    791794 
     795 
    792796    if (node->type != PredictorNode) 
    793         ss >> node->split_attr >> node->split; 
     797    { 
     798        ss >> node->split_attr; 
     799 
     800        /* Read split into a string and use strtod to parse it. 
     801         * istream sometimes (on some platforms) seems to have problems 
     802         * reading formated floats. 
     803         */ 
     804        ss >> split_string; 
     805        node->split = float(strtod(split_string.c_str(), NULL)); 
     806    } 
    794807 
    795808    if (node->children_size) { 
Note: See TracChangeset for help on using the changeset viewer.