summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/mpprint.c16
-rw-r--r--py/mpprint.h3
-rw-r--r--py/objstr.c1
3 files changed, 4 insertions, 16 deletions
diff --git a/py/mpprint.c b/py/mpprint.c
index 51c16f4e3d..6da6614b7c 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -363,21 +363,11 @@ int mp_print_float(const mp_print_t *print, mp_float_t f, char fmt, int flags, c
if ((flags & PF_FLAG_PAD_AFTER_SIGN) && buf[0] < '0') {
// We have a sign character
s++;
- if (*s <= '9' || (flags & PF_FLAG_PAD_NAN_INF)) {
- // We have a number, or we have a inf/nan and PAD_NAN_INF is set
- // With '{:06e}'.format(float('-inf')) you get '-00inf'
- chrs += mp_print_strn(print, &buf[0], 1, 0, 0, 1);
- width--;
- len--;
- }
+ chrs += mp_print_strn(print, &buf[0], 1, 0, 0, 1);
+ width--;
+ len--;
}
- if (*s > 'A' && (flags & PF_FLAG_PAD_NAN_INF) == 0) {
- // We have one of the inf or nan variants, suppress zero fill.
- // With printf, if you use: printf("%06e", -inf) then you get " -inf"
- // so suppress the zero fill.
- fill = ' ';
- }
chrs += mp_print_strn(print, s, len, flags, fill, width);
return chrs;
diff --git a/py/mpprint.h b/py/mpprint.h
index ceea3b978d..1770fcffe3 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -37,8 +37,7 @@
#define PF_FLAG_PAD_AFTER_SIGN (0x040)
#define PF_FLAG_CENTER_ADJUST (0x080)
#define PF_FLAG_ADD_PERCENT (0x100)
-#define PF_FLAG_PAD_NAN_INF (0x200)
-#define PF_FLAG_SHOW_OCTAL_LETTER (0x400)
+#define PF_FLAG_SHOW_OCTAL_LETTER (0x200)
typedef void (*mp_print_strn_t)(void *data, const char *str, mp_uint_t len);
diff --git a/py/objstr.c b/py/objstr.c
index 0246262a51..d11f097fca 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1200,7 +1200,6 @@ mp_obj_t mp_obj_str_format(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwa
type = 'g';
}
- flags |= PF_FLAG_PAD_NAN_INF; // '{:06e}'.format(float('-inf')) should give '-00inf'
switch (type) {
#if MICROPY_PY_BUILTINS_FLOAT
case 'e':