Throw an exception if mpfr_asprintf fails
This commit is contained in:
parent
10df662166
commit
75363003bd
1 changed files with 4 additions and 1 deletions
|
|
@ -130,7 +130,10 @@ namespace {
|
||||||
mpfr_set_prec(tempfb, bits + amount_t::extend_by_digits*8);
|
mpfr_set_prec(tempfb, bits + amount_t::extend_by_digits*8);
|
||||||
mpfr_set_q(tempfb, quant, GMP_RNDN);
|
mpfr_set_q(tempfb, quant, GMP_RNDN);
|
||||||
|
|
||||||
mpfr_asprintf(&buf, "%.*Rf", prec, tempfb);
|
if (mpfr_asprintf(&buf, "%.*Rf", prec, tempfb) < 0)
|
||||||
|
throw_(amount_error,
|
||||||
|
_("Cannot output amount to a floating-point representation"));
|
||||||
|
|
||||||
DEBUG("amount.convert",
|
DEBUG("amount.convert",
|
||||||
"mpfr_print = " << buf << " (precision " << prec << ")");
|
"mpfr_print = " << buf << " (precision " << prec << ")");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue