diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-11 14:43:40 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-11 14:43:40 +0300 |
commit | 1edb964dbdb07174e5822727df8ae45b32eb965f (patch) | |
tree | 05d8b8fcdc52c5bc6f405c2feb4c3410014eb3ca /profile.c | |
parent | cff5f2ecabdb84929f482f731bbcce21e47f092d (diff) | |
parent | 662a50264f770f5bd972bee0e1980b9cb08ff41d (diff) | |
download | egawk-1edb964dbdb07174e5822727df8ae45b32eb965f.tar.gz egawk-1edb964dbdb07174e5822727df8ae45b32eb965f.tar.bz2 egawk-1edb964dbdb07174e5822727df8ae45b32eb965f.zip |
Merge branch 'master' into feature/typed-regex
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 39 |
1 files changed, 3 insertions, 36 deletions
@@ -1510,45 +1510,12 @@ pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool strong char * pp_number(NODE *n) { -#define PP_PRECISION 6 char *str; -#ifdef HAVE_MPFR - size_t count; - - if (is_mpg_float(n)) { - count = mpfr_get_prec(n->mpg_numbr) / 3; /* ~ 3.22 binary digits per decimal digit */ - emalloc(str, char *, count, "pp_number"); - /* - * 3/2015: Format string used to be "%0.*R*g". That padded - * with leading zeros. But it doesn't do that for regular - * numbers in the non-MPFR case. - */ - mpfr_sprintf(str, "%.*R*g", PP_PRECISION, ROUND_MODE, n->mpg_numbr); - } else if (is_mpg_integer(n)) { - count = mpz_sizeinbase(n->mpg_i, 10) + 2; /* +1 for sign, +1 for NUL at end */ - emalloc(str, char *, count, "pp_number"); - mpfr_sprintf(str, "%Zd", n->mpg_i); - } else -#endif - { - /* Use format_val() to get integral values printed as integers */ - NODE *s; - - getnode(s); - *s = *n; - s->flags &= ~STRCUR; - - s = r_format_val("%.6g", 0, s); - - s->stptr[s->stlen] = '\0'; - str = s->stptr; - - freenode(s); - } - + assert((n->flags & NUMCONSTSTR) != 0); + emalloc(str, char *, n->stlen + 1, "pp_number"); + strcpy(str, n->stptr); return str; -#undef PP_PRECISION } /* pp_node --- pretty format a node */ |