MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / decimal128FromString

Function decimal128FromString

extern/decNumber/decimal128.c:451–465  ·  view source on GitHub ↗

------------------------------------------------------------------ */ to-number -- conversion from numeric string */ / decimal128FromString(result, string, set); */ / result is the decimal128 format number which gets the result of */ the conversion */ string is the character string which should contain a vali

Source from the content-addressed store, hash-verified

449/* If an error occurs, the result will be a valid decimal128 NaN. */
450/* ------------------------------------------------------------------ */
451decimal128 * decimal128FromString(decimal128 *result, const char *string,
452 decContext *set) {
453 decContext dc; // work
454 decNumber dn; // ..
455
456 decContextDefault(&dc, DEC_INIT_DECIMAL128); // no traps, please
457 dc.round=set->round; // use supplied rounding
458
459 decNumberFromString(&dn, string, &dc); // will round if needed
460 decimal128FromNumber(result, &dn, &dc);
461 if (dc.status!=0) { // something happened
462 decContextSetStatus(set, dc.status); // .. pass it on
463 }
464 return result;
465 } // decimal128FromString
466
467/* ------------------------------------------------------------------ */
468/* decimal128IsCanonical -- test whether encoding is canonical */

Callers

nothing calls this directly

Calls 4

decContextDefaultFunction · 0.85
decNumberFromStringFunction · 0.85
decimal128FromNumberFunction · 0.85
decContextSetStatusFunction · 0.85

Tested by

no test coverage detected