On Thu, 1 Sep 2011, Thomas Mayer wrote:

        if (float_value == 0 && strcmp(string_value, "0") != 0) {
                SETSYMBOL(&out_data[1], gensym(string_value));
        } else {
                SETFLOAT(&out_data[1], float_value);
        }
Now, it is working as intended. Is this the "standard" way in C to get possible floats out of strings?

It will not catch "-0".

I think that comparing pointers of strtof() is a safer bet... though "-0" rarely happens.

 _______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to