------------------------------------------------------------------ */ to-number -- conversion from numeric string */ / decimal32FromString(result, string, set); */ / result is the decimal32 format number which gets the result of */ the conversion */ string is the character string which should contain a vali
| 376 | /* If an error occurs, the result will be a valid decimal32 NaN. */ |
| 377 | /* ------------------------------------------------------------------ */ |
| 378 | decimal32 * decimal32FromString(decimal32 *result, const char *string, |
| 379 | decContext *set) { |
| 380 | decContext dc; // work |
| 381 | decNumber dn; // .. |
| 382 | |
| 383 | decContextDefault(&dc, DEC_INIT_DECIMAL32); // no traps, please |
| 384 | dc.round=set->round; // use supplied rounding |
| 385 | |
| 386 | decNumberFromString(&dn, string, &dc); // will round if needed |
| 387 | decimal32FromNumber(result, &dn, &dc); |
| 388 | if (dc.status!=0) { // something happened |
| 389 | decContextSetStatus(set, dc.status); // .. pass it on |
| 390 | } |
| 391 | return result; |
| 392 | } // decimal32FromString |
| 393 | |
| 394 | /* ------------------------------------------------------------------ */ |
| 395 | /* decimal32IsCanonical -- test whether encoding is canonical */ |
nothing calls this directly
no test coverage detected