------------------------------------------------------------------ */ to-number -- conversion from numeric string */ / decimal64FromString(result, string, set); */ / result is the decimal64 format number which gets the result of */ the conversion */ string is the character string which should contain a vali
| 437 | /* If an error occurs, the result will be a valid decimal64 NaN. */ |
| 438 | /* ------------------------------------------------------------------ */ |
| 439 | decimal64 * decimal64FromString(decimal64 *result, const char *string, |
| 440 | decContext *set) { |
| 441 | decContext dc; // work |
| 442 | decNumber dn; // .. |
| 443 | |
| 444 | decContextDefault(&dc, DEC_INIT_DECIMAL64); // no traps, please |
| 445 | dc.round=set->round; // use supplied rounding |
| 446 | |
| 447 | decNumberFromString(&dn, string, &dc); // will round if needed |
| 448 | |
| 449 | decimal64FromNumber(result, &dn, &dc); |
| 450 | if (dc.status!=0) { // something happened |
| 451 | decContextSetStatus(set, dc.status); // .. pass it on |
| 452 | } |
| 453 | return result; |
| 454 | } // decimal64FromString |
| 455 | |
| 456 | /* ------------------------------------------------------------------ */ |
| 457 | /* decimal64IsCanonical -- test whether encoding is canonical */ |
nothing calls this directly
no test coverage detected